From aea7c89175f6e326a76280ee43b33bb5cb172709 Mon Sep 17 00:00:00 2001 From: Xavier Le Vourch Date: Thu, 11 Dec 2008 07:09:45 +0000 Subject: [PATCH] oops, NPE in previous commit... git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@6749 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd/src/net/sourceforge/pmd/rules/design/UseSingleton.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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;