Skip to content

Commit b9b9107

Browse files
committed
Try with a try
1 parent 11fe775 commit b9b9107

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/util/SourceFile.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ class SourceFile(val file: AbstractFile, computeContent: => Array[Char]) extends
5252

5353
def maybeIncomplete: Boolean = _maybeInComplete
5454

55-
def this(file: AbstractFile, codec: Codec) = this(file, if file.exists then new String(file.toByteArray, codec.charSet).toCharArray else Array[Char]())
55+
def this(file: AbstractFile, codec: Codec) =
56+
this(file,
57+
try new String(file.toByteArray, codec.charSet).toCharArray
58+
catch case _: java.nio.file.NoSuchFileException => Array[Char]())
5659

5760
/** Tab increment; can be overridden */
5861
def tabInc: Int = 8

0 commit comments

Comments
 (0)