Skip to content

Commit

Permalink
GP-4919: Fixing exception that could occur if LoadSpec wasn't found for
Browse files Browse the repository at this point in the history
some reason (#7185)
  • Loading branch information
ryanmkurtz committed Nov 22, 2024
1 parent 760f2a2 commit b95350f
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -549,14 +549,19 @@ static LoadSpec getLoadSpec(ByteProvider provider, Program program) {
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);
}
Expand Down

0 comments on commit b95350f

Please sign in to comment.