Skip to content

Commit 901c9da

Browse files
committed
Fix null pointer dereference when a file is not an object file
1 parent 7c972d7 commit 901c9da

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ LLVMRustGetSymbols(char *BufPtr, size_t BufLen, void *State,
8080
return ErrorCallback(toString(ObjOrErr.takeError()).c_str());
8181
}
8282
std::unique_ptr<object::SymbolicFile> Obj = std::move(*ObjOrErr);
83+
if (Obj == nullptr) {
84+
return 0;
85+
}
8386

8487
for (const object::BasicSymbolRef &S : Obj->symbols()) {
8588
if (!isArchiveSymbol(S))

0 commit comments

Comments
 (0)