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