Skip to content

Commit

Permalink
Fixed FileNotFoundException while scanning FS (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
shyiko committed Mar 7, 2017
1 parent 4fe6a3e commit bb3a55a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ktlint/src/main/kotlin/com/github/shyiko/ktlint/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,15 @@ ${ByteArrayOutputStream().let { this.printUsage(it); it }.toString().trimEnd().s
return generateSequence(fun (): File? {
while (true) {
val file = stack.pollLast()
if (file != null && file.isDirectory) {
if (file == null || file.isFile) {
return file
}
if (file.isDirectory) {
val fileList = file.listFiles(filter)
if (fileList != null) {
stack.addAll(fileList)
}
continue
}
return file
}
})
}
Expand Down

0 comments on commit bb3a55a

Please # to comment.