summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJohn Cortell2012-07-17 22:45:18 (EDT)
committer Mickael Istria2012-07-18 03:57:35 (EDT)
commit3ab699559105c80d2952cae6fad1380a2c838ad2 (patch)
tree3a4f089b0100c286aafe5b0f3b6af43e1e122338
parenteb179688978e54f2eacbcd71426869551d369008 (diff)
downloadorg.eclipse.swtbot-3ab699559105c80d2952cae6fad1380a2c838ad2.zip
org.eclipse.swtbot-3ab699559105c80d2952cae6fad1380a2c838ad2.tar.gz
org.eclipse.swtbot-3ab699559105c80d2952cae6fad1380a2c838ad2.tar.bz2
Bug 385359 - SWTBotTreeItem.getItems() should guard against disposed tree items
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTreeItem.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTreeItem.java b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTreeItem.java
index bc5df7c..106273d 100644
--- a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTreeItem.java
+++ b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTreeItem.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* Copyright (c) 2008, 2010 Ketan Padegaonkar and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -678,11 +678,13 @@ public class SWTBotTreeItem extends AbstractSWTBot<TreeItem> {
return syncExec(new ArrayResult<SWTBotTreeItem>() {
public SWTBotTreeItem[] run() {
TreeItem[] items = widget.getItems();
- SWTBotTreeItem[] children = new SWTBotTreeItem[items.length];
+ List<SWTBotTreeItem> children = new ArrayList<SWTBotTreeItem>();
for (int i = 0; i < items.length; i++) {
- children[i] = new SWTBotTreeItem(items[i]);
+ if (!items[i].isDisposed()) {
+ children.add(new SWTBotTreeItem(items[i]));
+ }
}
- return children;
+ return children.toArray(new SWTBotTreeItem[children.size()]);
}
});
}