Commit 77a06476 authored by Laszlo Kishalmi's avatar Laszlo Kishalmi
Browse files

[NETBEANS-5340] Prevent NPE on TaskNode when opening Gradle Projects

parent e59eca10
...@@ -260,6 +260,7 @@ public class TasksPanel extends javax.swing.JPanel implements ExplorerManager.Pr ...@@ -260,6 +260,7 @@ public class TasksPanel extends javax.swing.JPanel implements ExplorerManager.Pr
private final ChangeListener listener; private final ChangeListener listener;
public FavoritesChildren() { public FavoritesChildren() {
assert currentP != null;
FavoriteTaskManager fvm = getFavoriteTaskManager(); FavoriteTaskManager fvm = getFavoriteTaskManager();
listener = (e) -> { listener = (e) -> {
Set<GradleTask> favs = fvm.getFavoriteTasks(); Set<GradleTask> favs = fvm.getFavoriteTasks();
...@@ -271,7 +272,11 @@ public class TasksPanel extends javax.swing.JPanel implements ExplorerManager.Pr ...@@ -271,7 +272,11 @@ public class TasksPanel extends javax.swing.JPanel implements ExplorerManager.Pr
@Override @Override
protected Node[] createNodes(GradleTask key) { protected Node[] createNodes(GradleTask key) {
return new Node[] {new TaskNode(currentP, key)}; // NETBEANS-5340 It might happen that the currentP is null, but the listener
// still active on the previous project.
return currentP != null ?
new Node[] {new TaskNode(currentP, key)} :
new Node[0];
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment