From d40c1f8ee5b5f85b90ee20b987e06b6715150fc2 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Wed, 4 Sep 2013 13:41:00 +0200 Subject: [PATCH] IDEA-113175 Expanding nodes in Variables(Debug tools window) while debug application throws exception --- .../intellij/util/ui/tree/WideSelectionTreeUI.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/platform/util/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java b/platform/util/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java index 8fafbf139b12..05693bdfb267 100644 --- a/platform/util/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java +++ b/platform/util/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java @@ -72,7 +72,6 @@ public class WideSelectionTreeUI extends BasicTreeUI { boolean handled = false; public void mousePressed(@NotNull final MouseEvent e) { handled = false; - if (!(e.getSource() instanceof JTree)) return; if (!isSelected(e)) { handled = true; handle(e); @@ -81,7 +80,6 @@ public class WideSelectionTreeUI extends BasicTreeUI { @Override public void mouseReleased(@NotNull final MouseEvent e) { - if (!(e.getSource() instanceof JTree)) return; if (!handled) { handle(e); } @@ -90,9 +88,12 @@ public class WideSelectionTreeUI extends BasicTreeUI { private boolean isSelected(MouseEvent e) { final JTree tree = (JTree)e.getSource(); final int selected = tree.getClosestRowForLocation(e.getX(), e.getY()); - for (int row : tree.getSelectionRows()) { - if (row == selected) { - return true; + final int[] rows = tree.getSelectionRows(); + if (rows != null) { + for (int row : rows) { + if (row == selected) { + return true; + } } }