]> source.dussan.org Git - sonarqube.git/commitdiff
Fix Quality flaws
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 8 Sep 2016 15:09:14 +0000 (17:09 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 8 Sep 2016 15:09:14 +0000 (17:09 +0200)
sonar-duplications/src/main/java/org/sonar/duplications/detector/original/OriginalCloneDetectionAlgorithm.java

index be93463a5e4fae92cbda2855b9651a7f67c5ea52..46e57fa920954198ac1bcfa8bd8ce5d9b05a7e49 100644 (file)
@@ -156,7 +156,7 @@ public final class OriginalCloneDetectionAlgorithm {
           // fixed order) is equal to f(j) and only report in this case.
 
           Block first = currentBlocksGroup.first(originResourceId);
-          if (first.getIndexInFile() == j - 2) {
+          if (first != null && first.getIndexInFile() == j - 2) {
             // Godin: We report clones, which start in i-1 and end in j-2, so length is j-2-(i-1)+1=j-i
             reportClones(sameHashBlocksGroups[i], currentBlocksGroup, j - i);
           }