Fix null pointer dereference when a file is not an object file
This commit is contained in:
parent
7c972d75dc
commit
901c9daa05
1 changed files with 3 additions and 0 deletions
|
@ -80,6 +80,9 @@ LLVMRustGetSymbols(char *BufPtr, size_t BufLen, void *State,
|
||||||
return ErrorCallback(toString(ObjOrErr.takeError()).c_str());
|
return ErrorCallback(toString(ObjOrErr.takeError()).c_str());
|
||||||
}
|
}
|
||||||
std::unique_ptr<object::SymbolicFile> Obj = std::move(*ObjOrErr);
|
std::unique_ptr<object::SymbolicFile> Obj = std::move(*ObjOrErr);
|
||||||
|
if (Obj == nullptr) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (const object::BasicSymbolRef &S : Obj->symbols()) {
|
for (const object::BasicSymbolRef &S : Obj->symbols()) {
|
||||||
if (!isArchiveSymbol(S))
|
if (!isArchiveSymbol(S))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue