mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
👌 Avoid force unwrapping try (may crash)
This commit is contained in:
@ -14,14 +14,18 @@ class ValetDomainScanner: DomainScanner {
|
||||
|
||||
func resolveSiteCount(paths: [String]) -> Int {
|
||||
return paths.map { path in
|
||||
|
||||
let entries = try! FileSystem
|
||||
do {
|
||||
let entries = try FileSystem
|
||||
.getShallowContentsOfDirectory(path)
|
||||
|
||||
return entries
|
||||
.map { self.isSite($0, forPath: path) }
|
||||
.filter { $0 == true}
|
||||
.count
|
||||
} catch {
|
||||
Log.err("Unexpected error getting contents of \(path): \(error).")
|
||||
return 0
|
||||
}
|
||||
|
||||
}.reduce(0, +)
|
||||
}
|
||||
|
Reference in New Issue
Block a user