diff --git a/lldb/source/ValueObject/DILEval.cpp b/lldb/source/ValueObject/DILEval.cpp index f4b7f783d7b71..b437657d4ade3 100644 --- a/lldb/source/ValueObject/DILEval.cpp +++ b/lldb/source/ValueObject/DILEval.cpp @@ -50,6 +50,9 @@ GetTypeSystemFromCU(std::shared_ptr ctx) { return llvm::createStringError("no stack frame in this context"); SymbolContext symbol_context = stack_frame->GetSymbolContext(lldb::eSymbolContextCompUnit); + + if (!symbol_context.comp_unit) + return llvm::createStringError("no compile unit in this context"); lldb::LanguageType language = symbol_context.comp_unit->GetLanguage(); symbol_context = stack_frame->GetSymbolContext(lldb::eSymbolContextModule);