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,12 +290,14 @@ public class DAAPathFinder {
|
|||||||
private int countLoops() {
|
private int countLoops() {
|
||||||
DefaultMutableTreeNode treeNode = stack.getLastLeaf();
|
DefaultMutableTreeNode treeNode = stack.getLastLeaf();
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
int childCount = treeNode.getParent().getChildCount();
|
if (treeNode.getParent() != null) {
|
||||||
for (int i = 0; i < childCount; i++) {
|
int childCount = treeNode.getParent().getChildCount();
|
||||||
DefaultMutableTreeNode tNode = (DefaultMutableTreeNode) treeNode.getParent().getChildAt(i);
|
for (int i = 0; i < childCount; i++) {
|
||||||
PathElement e = (PathElement) tNode.getUserObject();
|
DefaultMutableTreeNode tNode = (DefaultMutableTreeNode) treeNode.getParent().getChildAt(i);
|
||||||
if (e != null && !e.isPseudoPathElement()) {
|
PathElement e = (PathElement) tNode.getUserObject();
|
||||||
counter++;
|
if (e != null && !e.isPseudoPathElement()) {
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return counter;
|
return counter;
|
||||||
|
Reference in New Issue
Block a user