Skip to content

Commit 9f59903

Browse files
committed
[Serialization] Return a nullptr instead of crashing
We got LLDB crash logs where `importer` is dereferenced. In the same crash log the parent frame correctly checks for nullptr, so this would fix the immediate crash. In LLDB it is not guaranteed that a ClagnImporter is installed at all times. rdar://166224928
1 parent a5d15e3 commit 9f59903

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/Serialization/Deserialization.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3114,6 +3114,8 @@ ModuleDecl *ModuleFile::getModule(ImportPath::Module name,
31143114
if (!UnderlyingModule && allowLoading) {
31153115
auto importer = getContext().getClangModuleLoader();
31163116
assert(importer && "no way to import shadowed module");
3117+
if (!importer)
3118+
return nullptr;
31173119
UnderlyingModule =
31183120
importer->loadModule(SourceLoc(), name.getTopLevelPath());
31193121
}

0 commit comments

Comments
 (0)