Skip to content

Commit

Permalink
Fix NPE when opening quick type hierarchy twice eclipse-jdt#2002
Browse files Browse the repository at this point in the history
  • Loading branch information
fedejeanne committed Feb 10, 2025
1 parent cb33fee commit 219f093
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,23 @@ protected TreeViewer createTreeViewer(Composite parent, int style) {

@Override
protected void inputChanged(Object input, Object oldInput) {
visited= new HashSet<>();
super.inputChanged(input, oldInput);
visited= null;
runWithVisited(() -> super.inputChanged(input, oldInput));
}


@Override
public void expandToLevel(Object elementOrTreePath, int level, boolean disableRedraw) {
runWithVisited(
() -> super.expandToLevel(elementOrTreePath, level, disableRedraw));
}

private void runWithVisited(Runnable r) {
try {
visited= new HashSet<>();
r.run();
} finally {
visited= null;
}
}

@Override
Expand Down

0 comments on commit 219f093

Please sign in to comment.