Skip to content

Commit

Permalink
Return false for isFile for empty strings (#2706)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsim authored Apr 6, 2019
2 parents 1d7b37b + 9cc97d6 commit ace6aad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
[Taiki Komaba](https://github.com/r-plus)
[#2700](https://github.com/realm/SwiftLint/issues/2700)

* Fix crash when running on Linux with Swift 5 without specifying a `--path`
value or specifying an empty string.
[Keith Smiley](https://github.com/keith)
[#2703](https://github.com/realm/SwiftLint/issues/2703)

## 0.31.0: Busy Laundromat

#### Breaking
Expand Down
3 changes: 3 additions & 0 deletions Source/SwiftLintFramework/Extensions/String+SwiftLint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ extension String {
}

internal var isFile: Bool {
if self.isEmpty {
return false
}
var isDirectoryObjC: ObjCBool = false
if FileManager.default.fileExists(atPath: self, isDirectory: &isDirectoryObjC) {
return !isDirectoryObjC.boolValue
Expand Down

0 comments on commit ace6aad

Please sign in to comment.