mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-23 03:58:56 -04:00
Do not crash if we are searching on a zim file without fulltext index.
`Searcher::search` throw a exception if there is no fulltext index in the zim file. We must be prepared for this.
This commit is contained in:
parent
949184d13a
commit
58d6d1a7ea
@ -106,7 +106,12 @@ UrlSchemeHandler::handleSearchRequest(QWebEngineUrlRequestJob* request)
|
||||
auto end = start + pageLength;
|
||||
|
||||
auto searcher = app->getLibrary()->getSearcher(bookId);
|
||||
searcher->search(searchQuery, start, end);
|
||||
try {
|
||||
searcher->search(searchQuery, start, end);
|
||||
} catch(std::runtime_error&) {
|
||||
request->fail(QWebEngineUrlRequestJob::UrlInvalid);
|
||||
return;
|
||||
}
|
||||
|
||||
IdNameMapper nameMapper;
|
||||
kiwix::SearchRenderer renderer(searcher.get(), &nameMapper);
|
||||
|
Loading…
x
Reference in New Issue
Block a user