mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-23 04:39:55 +00:00
GP-4919: Fixing exception that could occur if LoadSpec wasn't found for
some reason (#7185)
This commit is contained in:
parent
760f2a28c2
commit
b95350f725
@ -549,14 +549,19 @@ public class ImporterUtilities {
|
||||
LoaderMap loaderMap = LoaderService.getSupportedLoadSpecs(provider,
|
||||
loader -> loader.getName().equalsIgnoreCase(program.getExecutableFormat()));
|
||||
|
||||
if (loaderMap.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Loader loader = loaderMap.firstKey();
|
||||
if (loader == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LanguageCompilerSpecPair programLcs = program.getLanguageCompilerSpecPair();
|
||||
return loaderMap.get(loader)
|
||||
.stream()
|
||||
.filter(
|
||||
e -> e.getLanguageCompilerSpec().equals(program.getLanguageCompilerSpecPair()))
|
||||
.filter(e -> programLcs.equals(e.getLanguageCompilerSpec()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user