diff --git a/pmd/src/net/sourceforge/pmd/rules/design/UseSingleton.java b/pmd/src/net/sourceforge/pmd/rules/design/UseSingleton.java index 8f7a078348..4778db671e 100644 --- a/pmd/src/net/sourceforge/pmd/rules/design/UseSingleton.java +++ b/pmd/src/net/sourceforge/pmd/rules/design/UseSingleton.java @@ -26,7 +26,11 @@ public class UseSingleton extends AbstractRule { int methodCount = 0; boolean isOK = false; while (i > 0) { - Node n = decl.jjtGetChild(--i).jjtGetChild(0); + Node n = decl.jjtGetChild(--i); + if (n.jjtGetNumChildren() != 1) { + break; + } + n = n.jjtGetChild(0); if (n instanceof ASTFieldDeclaration) { if (!((ASTFieldDeclaration) n).isStatic()) { isOK = true;