Skip to content

Commit

Permalink
Fix for crash on lazy compactMap unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
amddg44 committed Sep 26, 2023
1 parent 56e861d commit 009fdcd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Core/WebCacheManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,12 @@ public class WebCacheManager {
.appendingPathComponent("WebKit/\(bundleID)/WebsiteData/ResourceLoadStatistics/observations.db")
]

return databaseURLs.lazy.compactMap({ try? DatabasePool(path: $0.absoluteString) }).first
guard let validURL = databaseURLs.first(where: { FileManager.default.fileExists(atPath: $0.path) }),
let pool = try? DatabasePool(path: validURL.absoluteString) else {
return nil
}

return pool
}


Expand Down

0 comments on commit 009fdcd

Please sign in to comment.