diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/reader/ZimFileReader.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/reader/ZimFileReader.kt index 42dd73eec..fc03a0451 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/reader/ZimFileReader.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/reader/ZimFileReader.kt @@ -136,8 +136,13 @@ class ZimFileReader constructor( null } - fun searchSuggestions(prefix: String): Search = - searcher.search(Query(prefix)) + fun searchSuggestions(prefix: String): Search? = + try { + searcher.search(Query(prefix)) + } catch (ignore: Exception) { + // to handled the exception if there is no FT Xapian index found in the current zim file + null + } fun getNextSuggestion(suggestionSearch: SuggestionSearch?): List { val suggestionList = mutableListOf()