forked from phoedos/pmd
Fixed 1597987: NPE in new DaaRule
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4805 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -290,6 +290,7 @@ public class DAAPathFinder {
|
|||||||
private int countLoops() {
|
private int countLoops() {
|
||||||
DefaultMutableTreeNode treeNode = stack.getLastLeaf();
|
DefaultMutableTreeNode treeNode = stack.getLastLeaf();
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
if (treeNode.getParent() != null) {
|
||||||
int childCount = treeNode.getParent().getChildCount();
|
int childCount = treeNode.getParent().getChildCount();
|
||||||
for (int i = 0; i < childCount; i++) {
|
for (int i = 0; i < childCount; i++) {
|
||||||
DefaultMutableTreeNode tNode = (DefaultMutableTreeNode) treeNode.getParent().getChildAt(i);
|
DefaultMutableTreeNode tNode = (DefaultMutableTreeNode) treeNode.getParent().getChildAt(i);
|
||||||
@ -298,6 +299,7 @@ public class DAAPathFinder {
|
|||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return counter;
|
return counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user