From 94c111af7608adf8650bde6f1dd5924378963c1c Mon Sep 17 00:00:00 2001 From: Junichi Yamamoto Date: Wed, 18 Dec 2024 12:49:27 +0900 Subject: [PATCH] Prevent NPE - Add `null` check because it may be `null` when the mark occurrences feature is canceled --- .../modules/php/editor/csl/OccurrencesFinderImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/csl/OccurrencesFinderImpl.java b/php/php.editor/src/org/netbeans/modules/php/editor/csl/OccurrencesFinderImpl.java index 066d610920c0..1907f3794e33 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/csl/OccurrencesFinderImpl.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/csl/OccurrencesFinderImpl.java @@ -69,7 +69,9 @@ public void setCaretPosition(int position) { @Override public Map getOccurrences() { // must not return null - return Collections.unmodifiableMap(range2Attribs); + return range2Attribs != null + ? Collections.unmodifiableMap(range2Attribs) + : Collections.emptyMap(); } @Override