summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorSilenio Quarti2013-03-14 10:51:05 (EDT)
committer Carolyn MacLeod2013-03-19 12:02:33 (EDT)
commit226ea5bed1873d5775283d34e92066d89309b5bc (patch)
tree6316531bb1baf509bab7b26fe712b8b27dab86f1
parent568c035dbfe8c346bb7f513d98cb80fd12c78ce8 (diff)
downloadeclipse.platform.swt-226ea5bed1873d5775283d34e92066d89309b5bc.zip
eclipse.platform.swt-226ea5bed1873d5775283d34e92066d89309b5bc.tar.gz
eclipse.platform.swt-226ea5bed1873d5775283d34e92066d89309b5bc.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;