summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorSilenio Quarti2013-03-14 10:51:05 (EDT)
committer Carolyn MacLeod2013-03-22 10:10:44 (EDT)
commitc01f2a92fe46183a52ab56aca3a01470ff3bd132 (patch)
treeb60a28fbbbf3cbb805baa2d4749d0711dd1f156c
parentabb39761d4cc9d18a082b1b7cfad16b4f5697e6f (diff)
downloadeclipse.platform.swt-c01f2a92fe46183a52ab56aca3a01470ff3bd132.zip
eclipse.platform.swt-c01f2a92fe46183a52ab56aca3a01470ff3bd132.tar.gz
eclipse.platform.swt-c01f2a92fe46183a52ab56aca3a01470ff3bd132.tar.bz2
Bug 403346 - TreeViewers throw NPE's on collapsed multi-selections
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
index 94c306b..2912fb2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
@@ -3466,7 +3466,12 @@ public TreeItem [] getSelection () {
int itemCount = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0);
boolean bigSelection = result.length > itemCount / 2;
if (count != getSelection (hItem, tvItem, result, 0, count, bigSelection, false)) {
- getSelection (hItem, tvItem, result, 0, count, bigSelection, true);
+ count = getSelection (hItem, tvItem, result, 0, count, bigSelection, true);
+ }
+ if (count != result.length) {
+ TreeItem[] newResult = new TreeItem[count];
+ System.arraycopy (result, 0, newResult, 0, count);
+ result = newResult;
}
OS.SetWindowLongPtr (handle, OS.GWLP_WNDPROC, oldProc);
return result;