Fixed removing nil items so that cast to [Favicon] can succeed

This commit is contained in:
dankito 2020-07-31 00:21:06 +02:00
parent fb071f8826
commit a2785244a1
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ class FaviconFinder {
} }
func extractFavicons(document: Document, url: String) -> [Favicon] { func extractFavicons(document: Document, url: String) -> [Favicon] {
var extractedFavicons = (try? document.head()?.select("link, meta").map { mapElementToFavicon($0, url) } as? [Favicon]) ?? [] var extractedFavicons = (try? document.head()?.select("link, meta"))?.map { mapElementToFavicon($0, url) }.filter { $0 != nil } as? [Favicon] ?? []
tryToFindDefaultFavicon(url, &extractedFavicons) tryToFindDefaultFavicon(url, &extractedFavicons)