From a2785244a13a818ad396f12acbc9ee299b2cead6 Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 31 Jul 2020 00:21:06 +0200 Subject: [PATCH] Fixed removing nil items so that cast to [Favicon] can succeed --- .../BankingiOSApp/BankIconFinder/FaviconFinder.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/BankingiOSApp/BankingiOSApp/BankIconFinder/FaviconFinder.swift b/ui/BankingiOSApp/BankingiOSApp/BankIconFinder/FaviconFinder.swift index 8fedc212..c21512cb 100644 --- a/ui/BankingiOSApp/BankingiOSApp/BankIconFinder/FaviconFinder.swift +++ b/ui/BankingiOSApp/BankingiOSApp/BankIconFinder/FaviconFinder.swift @@ -32,7 +32,7 @@ class FaviconFinder { } 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)