Skip to content

Commit ac6cd1c

Browse files
authored
Fix crash in -Vprofile code (scala#16007)
Fixes scala#16003
2 parents 282b68b + d5db550 commit ac6cd1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/reporting/Profile.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class ActiveProfile(details: Int) extends Profile:
103103
name, info.lineCount, info.tokenCount, Profile.chunks(info.tastySize),
104104
s"${"%6.2f".format(complexity)} $explanation", path))
105105

106-
def safeMax(xs: Array[Int]) = xs.max.max(10).min(50)
106+
def safeMax(xs: Array[Int]) = if xs.isEmpty then 10 else xs.max.max(10).min(50)
107107

108108
def printAndAggregateSourceInfos(): Profile.Info =
109109
val sourceNameWidth = safeMax(units.map(_.source.file.name.length))

0 commit comments

Comments
 (0)