From 027dd4726c5df08f0a959778896031af9d7db3ec Mon Sep 17 00:00:00 2001 From: Xavier Le Vourch Date: Fri, 2 Nov 2007 19:57:23 +0000 Subject: [PATCH] bug fix: NPE on empty ruleset git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5620 51baf565-9d33-0410-a72c-fc3788e3496d --- .../runtime/properties/impl/ProjectPropertiesManagerImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pmd-eclipse-plugin/pmd-eclipse-runtime/src/net/sourceforge/pmd/runtime/properties/impl/ProjectPropertiesManagerImpl.java b/pmd-eclipse-plugin/pmd-eclipse-runtime/src/net/sourceforge/pmd/runtime/properties/impl/ProjectPropertiesManagerImpl.java index 62cfe05ac6..158c2feda7 100644 --- a/pmd-eclipse-plugin/pmd-eclipse-runtime/src/net/sourceforge/pmd/runtime/properties/impl/ProjectPropertiesManagerImpl.java +++ b/pmd-eclipse-plugin/pmd-eclipse-runtime/src/net/sourceforge/pmd/runtime/properties/impl/ProjectPropertiesManagerImpl.java @@ -247,7 +247,8 @@ public class ProjectPropertiesManagerImpl implements IProjectPropertiesManager { private void setRuleSetFromProperties(IProjectProperties projectProperties, RuleSpecTO[] rules) throws PropertiesException { final RuleSet ruleSet = new RuleSet(); final RuleSet pluginRuleSet = PMDRuntimePlugin.getDefault().getPreferencesManager().getRuleSet(); - for (int i = 0; i < rules.length; i++) { + int n = rules==null?0:rules.length; + for (int i = 0; i < n; i++) { try { final Rule rule = pluginRuleSet.getRuleByName(rules[i].getName()); ruleSet.addRule(rule);