From 8c57208d6ac86074fc79aee4d56b2176f4d51247 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Sun, 14 Apr 2024 17:40:10 +0200 Subject: [PATCH 1/2] Squashed commit of the following: commit b3f47fa8c0708aca20ac391144b08bbd13724768 Merge: a90d196 b019f69 Author: Balazs Perlaki-Horvath Date: Sun Apr 14 17:35:12 2024 +0200 Merge branch '622-corrupted-zim-leads-to-crash' of github.com:kiwix/apple into 622-corrupted-zim-leads-to-crash commit a90d196e65a02a94d885eabd8c7c6e0d2b2334e8 Author: Balazs Perlaki-Horvath Date: Tue Apr 9 21:31:22 2024 +0200 Update try catch commit b784b27c9cd882179c8d75fbb8a27ee370d03257 Author: Balazs Perlaki-Horvath Date: Tue Apr 9 13:19:11 2024 +0200 Wrap search in standard exception handling commit b019f698c8cbaac1d09fb9067fb8bc1cc84070e7 Merge: d6e8e9a 8541cde Author: Balazs Perlaki-Horvath Date: Tue Apr 9 23:54:53 2024 +0200 Merge branch '622-corrupted-zim-leads-to-crash' of github.com:kiwix/apple into 622-corrupted-zim-leads-to-crash commit d6e8e9ac3e4328ba6154a9597ebd2f950c711f20 Author: Balazs Perlaki-Horvath Date: Tue Apr 9 21:31:22 2024 +0200 Update try catch commit c1329127136088ec92ca25669f5455953c77844d Author: Balazs Perlaki-Horvath Date: Tue Apr 9 13:19:11 2024 +0200 Wrap search in standard exception handling commit 8541cde6b66570d26cfa8ef590303059b7c6c8d4 Author: Balazs Perlaki-Horvath Date: Tue Apr 9 13:19:11 2024 +0200 Wrap search in standard exception handling commit 57e008e5590b7567d4410057c590ce0914b8a37b Merge: 5024548 4459187 Author: Balazs Perlaki-Horvath Date: Tue Apr 9 13:02:15 2024 +0200 Merge branch '622-corrupted-zim-leads-to-crash' of github.com:kiwix/apple into 622-corrupted-zim-leads-to-crash commit 44591871ce85e4bb7d3a9d1454d03d3b36bf8488 Author: Balazs Perlaki-Horvath Date: Mon Apr 8 08:39:00 2024 +0200 Fix unlinked ZIM file tab state --- SwiftUI/Model/SearchOperation/SearchOperation.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SwiftUI/Model/SearchOperation/SearchOperation.mm b/SwiftUI/Model/SearchOperation/SearchOperation.mm index 11714698a..c608819c9 100644 --- a/SwiftUI/Model/SearchOperation/SearchOperation.mm +++ b/SwiftUI/Model/SearchOperation/SearchOperation.mm @@ -52,7 +52,7 @@ - (void)performSearch { // get a list of archives that are included in search typedef std::unordered_map archives_map; auto *allArchives = static_cast([[ZimFileService sharedInstance] getArchives]); - + std::vector indexSearchArchives = std::vector(); std::vector titleSearchArchives = std::vector(); for (NSUUID *zimFileID in self.zimFileIDs) { @@ -63,9 +63,9 @@ - (void)performSearch { indexSearchArchives.push_back(archive); } titleSearchArchives.push_back(archive); - } catch (std::out_of_range) { } + } catch (std::exception) { } } - + // perform index and title search [self addIndexSearchResults:indexSearchArchives]; if (titleSearchArchives.size() > 0) { From 06f7e32a376956f0bdd6eaddf56a99cfce7c24b2 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Sat, 20 Apr 2024 21:39:43 +0200 Subject: [PATCH 2/2] Add one more exception handler --- SwiftUI/Model/SearchOperation/SearchOperation.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SwiftUI/Model/SearchOperation/SearchOperation.mm b/SwiftUI/Model/SearchOperation/SearchOperation.mm index c608819c9..e8cda4eb1 100644 --- a/SwiftUI/Model/SearchOperation/SearchOperation.mm +++ b/SwiftUI/Model/SearchOperation/SearchOperation.mm @@ -67,7 +67,9 @@ - (void)performSearch { } // perform index and title search - [self addIndexSearchResults:indexSearchArchives]; + try { + [self addIndexSearchResults:indexSearchArchives]; + } catch (std::exception) { } if (titleSearchArchives.size() > 0) { int count = std::max((35 - (int)[self.results count]) / (int)titleSearchArchives.size(), 5); [self addTitleSearchResults:titleSearchArchives count:(int)count];