You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by pp...@apache.org on 2022/03/25 14:37:40 UTC

[netbeans] branch master updated: Fixing NPE in SpockUtils

This is an automated email from the ASF dual-hosted git repository.

ppisl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new f06a564  Fixing NPE in SpockUtils
     new a3c23fe  Merge pull request #3855 from ppisl/npe_in_spock_utils
f06a564 is described below

commit f06a56406d21d55a46223e9f642c5a8b72130652
Author: Petr Pisl <pe...@oracle.com>
AuthorDate: Fri Mar 25 11:39:53 2022 +0100

    Fixing NPE in SpockUtils
---
 .../org/netbeans/modules/groovy/editor/completion/SpockUtils.java    | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/completion/SpockUtils.java b/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/completion/SpockUtils.java
index 218b838..508d544 100644
--- a/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/completion/SpockUtils.java
+++ b/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/completion/SpockUtils.java
@@ -38,6 +38,11 @@ public class SpockUtils {
     public static boolean isInSpecificationClass(CompletionContext context) {
         
         ClassNode classNode = context.declaringClass;
+        if (classNode == null) {
+            // This shouldn't happen, because this cc is invoked only INSIDE_METHOD cc location.
+            // But I have seed the NPE
+            return false;
+        }
         ParserResult pr = context.getParserResult();
         if (pr != null && pr instanceof GroovyParserResult) {
             GroovyParserResult gpr = (GroovyParserResult) pr;

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists