]> source.dussan.org Git - aspectj.git/commitdiff
Guard against NPE
authoraclement <aclement>
Thu, 7 Apr 2005 10:04:13 +0000 (10:04 +0000)
committeraclement <aclement>
Thu, 7 Apr 2005 10:04:13 +0000 (10:04 +0000)
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java

index ec48fdd5f28b8fe29685d4ae50da41f97b7bc219..26bf3f4b0d49d0884e595476e3aac6079d2d9d3b 100644 (file)
@@ -136,7 +136,10 @@ public class AspectJElementHierarchy implements IHierarchy {
                        if (packageName == null) {
                                packageNode = root;
                        } else {
-                               for (Iterator it = root.getChildren().iterator(); it.hasNext(); ) {
+                               if (root == null) return null;
+                               List kids = root.getChildren();
+                               if (kids == null) return null;
+                               for (Iterator it = kids.iterator(); it.hasNext(); ) {
                                        IProgramElement node = (IProgramElement)it.next();
                                        if (packageName.equals(node.getName())) {
                                                packageNode = node;