Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2013-03-14 14:51:05 +0000
committerCarolyn MacLeod2013-04-09 14:56:32 +0000
commit401f1518d5ba41d118c9d1bbf60f7c495620169f (patch)
treee41926781588270225907b4d4d0057afdb4e76e4
parent09c18db7e4dacf97a58ec58334cb8cca57112174 (diff)
downloadeclipse.platform.swt-401f1518d5ba41d118c9d1bbf60f7c495620169f.tar.gz
eclipse.platform.swt-401f1518d5ba41d118c9d1bbf60f7c495620169f.tar.xz
eclipse.platform.swt-401f1518d5ba41d118c9d1bbf60f7c495620169f.zip
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 e3fd80a933..f40580da9b 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;

Back to the top