diff options
author | Godin <mandrikov@gmail.com> | 2010-12-01 09:23:32 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-12-01 09:23:32 +0000 |
commit | 0441e5cb03ef5fcd21f681682a994437e985768d (patch) | |
tree | 268627918f8dac688e1103d4b70181ab35237adc /plugins | |
parent | 0621aa8238745bdb4460218f07695ea6f0a7630c (diff) | |
download | sonarqube-0441e5cb03ef5fcd21f681682a994437e985768d.tar.gz sonarqube-0441e5cb03ef5fcd21f681682a994437e985768d.zip |
SONAR-1450: Fix NPE in NewViolationsDecorator
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewViolationsDecorator.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewViolationsDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewViolationsDecorator.java index aa7c2ec1156..d64935cf3a3 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewViolationsDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewViolationsDecorator.java @@ -55,9 +55,11 @@ public class NewViolationsDecorator implements Decorator { public void decorate(Resource resource, DecoratorContext context) { Measure measure = new Measure(CoreMetrics.NEW_VIOLATIONS); for (int index = 0; index < 3; index++) { - int days = timeMachineConfiguration.getDiffPeriodInDays(index); - double value = calculate(context, days) + sumChildren(context, index); - setDiffValue(measure, index, value); + Integer days = timeMachineConfiguration.getDiffPeriodInDays(index); + if (days != null) { + double value = calculate(context, days) + sumChildren(context, index); + setDiffValue(measure, index, value); + } } context.saveMeasure(measure); } |