From c29ef77baf4d6a41aa878f37102d547c5fc72893 Mon Sep 17 00:00:00 2001 From: Johannes Koenen Date: Mon, 18 Dec 2023 11:41:47 +0100 Subject: [PATCH] Fix potential NPE in descriptor lookup In our existing implementation this NPE only occurs in artificial test-data, but it might also occur for other sarif producers --- .../com/jetbrains/qodana/sarif/baseline/DescriptorLookup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sarif/src/main/java/com/jetbrains/qodana/sarif/baseline/DescriptorLookup.java b/sarif/src/main/java/com/jetbrains/qodana/sarif/baseline/DescriptorLookup.java index ccabdea..fb6c87f 100644 --- a/sarif/src/main/java/com/jetbrains/qodana/sarif/baseline/DescriptorLookup.java +++ b/sarif/src/main/java/com/jetbrains/qodana/sarif/baseline/DescriptorLookup.java @@ -36,7 +36,7 @@ private Stream descriptors(Run run) { }) .orElseGet(Stream::empty); - Stream extRules = Optional.of(run.getTool()) + Stream extRules = Optional.ofNullable(run.getTool()) .map(Tool::getExtensions) .orElseGet(HashSet::new) .stream()