diff --git a/Core/WebCacheManager.swift b/Core/WebCacheManager.swift index d9d9c0a69f..3444380821 100644 --- a/Core/WebCacheManager.swift +++ b/Core/WebCacheManager.swift @@ -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 }