summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorSilenio Quarti2013-03-14 10:51:05 (EDT)
committer Carolyn MacLeod2013-04-09 10:56:32 (EDT)
commit401f1518d5ba41d118c9d1bbf60f7c495620169f (patch)
treee41926781588270225907b4d4d0057afdb4e76e4
parent09c18db7e4dacf97a58ec58334cb8cca57112174 (diff)
downloadeclipse.platform.swt-401f1518d5ba41d118c9d1bbf60f7c495620169f.zip
eclipse.platform.swt-401f1518d5ba41d118c9d1bbf60f7c495620169f.tar.gz
eclipse.platform.swt-401f1518d5ba41d118c9d1bbf60f7c495620169f.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 e3fd80a..f40580d 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
@@ -3486,7 +3486,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;