The VFS is null when it's invalid so return early in collectVFSFromYAML.
--- /dev/null
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: not %clang_cc1 -module-dependency-dir %t -ivfsoverlay %S/Inputs/invalid-yaml.yaml %s 2>&1 | FileCheck %s
+
+// CHECK: error: Unexpected token
+// CHECK: error: Unexpected token
+// CHECK: 1 error generated
std::unique_ptr<RedirectingFileSystem> VFS = RedirectingFileSystem::create(
std::move(Buffer), DiagHandler, YAMLFilePath, DiagContext,
std::move(ExternalFS));
+ if (!VFS)
+ return;
ErrorOr<RedirectingFileSystem::LookupResult> RootResult =
VFS->lookupPath("/");
if (!RootResult)