Skip to content

Commit

Permalink
🐛 fix case where when SARIF is parsed for the first time, it fails if…
Browse files Browse the repository at this point in the history
… the results list for a run is null rather than empty
  • Loading branch information
ryandens committed Nov 30, 2023
1 parent 9e94732 commit 62900b4
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ private Stream<Map.Entry<String, RuleSarif>> fromSarif(
ServiceLoader.load(RuleSarifFactory.class).stream()
.map(ServiceLoader.Provider::get)
.collect(Collectors.toUnmodifiableList());
final var runResults = run.getResults();
final var allResults =
run.getResults().stream()
.map(result -> extractRuleId(result, run))
.filter(Objects::nonNull)
.distinct();
runResults != null
? runResults.stream()
.map(result -> extractRuleId(result, run))
.filter(Objects::nonNull)
.distinct()
: Stream.<String>empty();

return allResults.flatMap(
rule -> tryToBuild(toolName, rule, sarif, repositoryRoot, factories).stream());
Expand Down

0 comments on commit 62900b4

Please sign in to comment.