Skip to content

Commit

Permalink
Merge pull request apache#8046 from junichi11/php-fix-npe
Browse files Browse the repository at this point in the history
Prevent NPE
  • Loading branch information
junichi11 authored Dec 13, 2024
2 parents 7d38f33 + a3f691c commit f00c1a4
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public void setCaretPosition(int position) {

@Override
public Map<OffsetRange, ColoringAttributes> getOccurrences() {
return range2Attribs;
// must not return null
return Collections.unmodifiableMap(range2Attribs);
}

@Override
Expand Down Expand Up @@ -99,9 +100,11 @@ public void run(Result result, SchedulerEvent event) {
return;
}

if (!node.getBoolean(MarkOccurencesSettings.KEEP_MARKS, true) || localRange2Attribs.size() > 0) {
//store the occurrences if not empty, return null in getOccurrences() otherwise
if (!node.getBoolean(MarkOccurencesSettings.KEEP_MARKS, true) || !localRange2Attribs.isEmpty()) {
//store the occurrences if not empty
range2Attribs = localRange2Attribs;
} else {
range2Attribs = Collections.emptyMap();
}
}

Expand Down

0 comments on commit f00c1a4

Please sign in to comment.