Skip to content

Commit 62900b4

Browse files
committed
🐛 fix case where when SARIF is parsed for the first time, it fails if the results list for a run is null rather than empty
1 parent 9e94732 commit 62900b4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

framework/codemodder-base/src/main/java/io/codemodder/DefaultSarifParser.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ private Stream<Map.Entry<String, RuleSarif>> fromSarif(
7171
ServiceLoader.load(RuleSarifFactory.class).stream()
7272
.map(ServiceLoader.Provider::get)
7373
.collect(Collectors.toUnmodifiableList());
74+
final var runResults = run.getResults();
7475
final var allResults =
75-
run.getResults().stream()
76-
.map(result -> extractRuleId(result, run))
77-
.filter(Objects::nonNull)
78-
.distinct();
76+
runResults != null
77+
? runResults.stream()
78+
.map(result -> extractRuleId(result, run))
79+
.filter(Objects::nonNull)
80+
.distinct()
81+
: Stream.<String>empty();
7982

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

0 commit comments

Comments
 (0)