GP-4919: Fixing exception that could occur if LoadSpec wasn't found for

some reason (#7185)
This commit is contained in:
Ryan Kurtz 2024-11-22 10:59:40 -05:00
parent 760f2a28c2
commit b95350f725

View File

@ -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);
}