]> source.dussan.org Git - sonarqube.git/commitdiff
Fix quality flaws
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 2 Jul 2014 08:17:16 +0000 (10:17 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 2 Jul 2014 08:18:41 +0000 (10:18 +0200)
sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java

index fa5e522f43c6ca71d8849cf720bf7777527111e5..dc35e6e3a79da55279c9da85e66ebbaeeafaa7c0 100644 (file)
@@ -236,10 +236,12 @@ public class RuleNormalizer extends BaseNormalizer<RuleDto, RuleKey> {
           CharacteristicDto characteristic, subCharacteristic = null;
           subCharacteristic = db.debtCharacteristicDao().selectById(subCharacteristicId, session);
           Integer characteristicId = subCharacteristic.getParentId();
-          characteristic = db.debtCharacteristicDao().selectById(characteristicId);
-          if (characteristic != null) {
-            update.put(RuleField.CHARACTERISTIC.field(), characteristic.getKey());
-            update.put(RuleField.SUB_CHARACTERISTIC.field(), subCharacteristic.getKey());
+          if (characteristicId != null) {
+            characteristic = db.debtCharacteristicDao().selectById(characteristicId);
+            if (characteristic != null) {
+              update.put(RuleField.CHARACTERISTIC.field(), characteristic.getKey());
+              update.put(RuleField.SUB_CHARACTERISTIC.field(), subCharacteristic.getKey());
+            }
           }
         }
       } else {