bug fix: NPE on empty ruleset

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5620 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch
2007-11-02 19:57:23 +00:00
parent 1776b3be48
commit 027dd4726c

View File

@ -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);