File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/coverage Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -44,14 +44,20 @@ class UTBotCoverageRunner : CoverageRunner() {
44
44
log.warn(" Skipping $localFilePath in coverage processing as it does not exist!" )
45
45
continue
46
46
}
47
- val lines = arrayOfNulls<LineData >(getLineCount(localFilePath))
47
+ val linesCount = getLineCount(localFilePath)
48
+ val lines = arrayOfNulls<LineData >(linesCount)
48
49
val classData = projectData.getOrCreateClassData(provideQualifiedNameForFile(localFilePath.toAbsolutePath().toString()))
49
50
fun processRanges (rangesList : List <Testgen .SourceLine ?>, status : Byte ) {
50
- rangesList.filterNotNull().forEach {
51
- val lineData = LineData (it.line + 1 , null )
51
+ rangesList.filterNotNull().forEach { sourceLine ->
52
+ val numberInFile = sourceLine.line - 1
53
+ if (numberInFile >= linesCount) {
54
+ log.warn(" Skipping $localFilePath :${numberInFile} in coverage processing! Number of lines in file is $linesCount !" )
55
+ return @forEach
56
+ }
57
+ val lineData = LineData (sourceLine.line + 1 , null )
52
58
lineData.hits = status.toInt()
53
59
lineData.setStatus(status)
54
- lines[it.line - 1 ] = lineData
60
+ lines[numberInFile ] = lineData
55
61
classData.registerMethodSignature(lineData)
56
62
}
57
63
}
You can’t perform that action at this time.
0 commit comments