aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2011-09-30 21:00:43 -0700
committerTor Norbye <tnorbye@google.com>2011-09-30 21:19:37 -0700
commit7ff203969509e6cd1f6de9ef6766b7b5adaadeff (patch)
tree1204613341edd504fcc56c22f1254fa2ed5df134
parent58add15e93f9aa2a339ed5923538721f43f6fa3d (diff)
downloadsdk-7ff203969509e6cd1f6de9ef6766b7b5adaadeff.zip
sdk-7ff203969509e6cd1f6de9ef6766b7b5adaadeff.tar.gz
sdk-7ff203969509e6cd1f6de9ef6766b7b5adaadeff.tar.bz2
Ensure that deletion hook is only run on valid parents
There's now a "deletion hook" for ViewRules where they get a chance to clean up after a set of children have been deleted. This changeset guards against the case where the parent reference was null. Change-Id: I3eef328ec5450a15588b29fff1d0d834388c4cde
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ClipboardSupport.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ClipboardSupport.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ClipboardSupport.java
index 2c91b74..d431653 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ClipboardSupport.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ClipboardSupport.java
@@ -210,12 +210,14 @@ public class ClipboardSupport {
for (SelectionItem cs : selection) {
NodeProxy node = cs.getNode();
INode parent = node.getParent();
- List<INode> children = clusters.get(parent);
- if (children == null) {
- children = new ArrayList<INode>();
- clusters.put((NodeProxy) parent, children);
+ if (parent != null) {
+ List<INode> children = clusters.get(parent);
+ if (children == null) {
+ children = new ArrayList<INode>();
+ clusters.put((NodeProxy) parent, children);
+ }
+ children.add(node);
}
- children.add(node);
}
// Notify parent views about children getting deleted