Fixed NPE in projects without build.gradle.
diff --git a/java/gradle.java/src/org/netbeans/modules/gradle/java/queries/GradleDependencyResult.java b/java/gradle.java/src/org/netbeans/modules/gradle/java/queries/GradleDependencyResult.java
index a7dd5de..eeeffd9 100644
--- a/java/gradle.java/src/org/netbeans/modules/gradle/java/queries/GradleDependencyResult.java
+++ b/java/gradle.java/src/org/netbeans/modules/gradle/java/queries/GradleDependencyResult.java
@@ -20,6 +20,7 @@
 
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
+import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -76,7 +77,8 @@
         this.gradleProject = gradleProject;
         this.root = root;
         this.gp = NbGradleProject.get(gradleProject);
-        this.projectFile = FileUtil.toFileObject(gp.getGradleFiles().getBuildScript());
+        File bs = gp.getGradleFiles().getBuildScript();
+        this.projectFile = bs == null ? null : FileUtil.toFileObject(gp.getGradleFiles().getBuildScript());
     }
     
     @Override
@@ -173,18 +175,21 @@
         });
         
         String contents = null;
-        EditorCookie cake = projectFile.getLookup().lookup(EditorCookie.class);
-        if (cake != null) {
-            Document doc = cake.getDocument();
-            if (doc != null) {
-                String[] docContent = new String[1];
-                doc.render(() -> {
-                    try {
-                        docContent[0] = doc.getText(0, doc.getLength());
-                    } catch (BadLocationException ex) {
-                        // ignore
-                    }
-                });
+        if (projectFile != null) {
+            EditorCookie cake = null;
+            cake = projectFile.getLookup().lookup(EditorCookie.class);
+            if (cake != null) {
+                Document doc = cake.getDocument();
+                if (doc != null) {
+                    String[] docContent = new String[1];
+                    doc.render(() -> {
+                        try {
+                            docContent[0] = doc.getText(0, doc.getLength());
+                        } catch (BadLocationException ex) {
+                            // ignore
+                        }
+                    });
+                }
             }
         }
         if (contents == null) {