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

lkishalmi 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 d4c991929a Fix potential NPE in GradleModuleFileCache21 when trying to 
resolve non-gradle artifacts.
d4c991929a is described below

commit d4c991929ac33daf2c8733b0f700e00e0f70acb7
Author: Laszlo Kishalmi <laszlo.kisha...@gmail.com>
AuthorDate: Wed Jun 8 16:20:14 2022 +0200

    Fix potential NPE in GradleModuleFileCache21 when trying to resolve 
non-gradle artifacts.
---
 .../src/org/netbeans/modules/gradle/GradleModuleFileCache21.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/extide/gradle/src/org/netbeans/modules/gradle/GradleModuleFileCache21.java 
b/extide/gradle/src/org/netbeans/modules/gradle/GradleModuleFileCache21.java
index b81a28a26b..7782891774 100644
--- a/extide/gradle/src/org/netbeans/modules/gradle/GradleModuleFileCache21.java
+++ b/extide/gradle/src/org/netbeans/modules/gradle/GradleModuleFileCache21.java
@@ -222,12 +222,16 @@ public final class GradleModuleFileCache21 {
     }
 
     public CachedArtifactVersion resolveCachedArtifactVersion(Path artifact) 
throws IllegalArgumentException {
-        return new CachedArtifactVersion(artifact.getParent().getParent());
+        return artifact == null
+                || artifact.getParent() == null
+                || artifact.getParent().getParent() == null
+                ?  null
+                :  new CachedArtifactVersion(artifact.getParent().getParent());
     }
 
     public CachedArtifactVersion.Entry resolveEntry(Path artifact) throws 
IllegalArgumentException {
         CachedArtifactVersion av = resolveCachedArtifactVersion(artifact);
-        return av.entries.get(artifact.getFileName().toString());
+        return av != null ? av.entries.get(artifact.getFileName().toString()) 
: null;
     }
 
     public CachedArtifactVersion resolveModule(String moduleId) throws 
IllegalArgumentException {


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

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

Reply via email to