diff --git a/SwiftUI/Model/SearchOperation/SearchOperation.mm b/SwiftUI/Model/SearchOperation/SearchOperation.mm index 11714698a..e8cda4eb1 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,11 +63,13 @@ - (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]; + 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];