From 9c426bc216d2ca61dd1168f119b4ddc99e770e47 Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 15 Mar 2022 22:20:41 -0400 Subject: [PATCH] Avoid crashing when global search encounters a NoClassDefFoundError --- .../eu/kanade/tachiyomi/source/online/HttpSource.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt index 5490b4624..ba4f782c9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt @@ -112,8 +112,15 @@ abstract class HttpSource : CatalogueSource { * @param filters the list of filters to apply. */ override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable { - return client.newCall(searchMangaRequest(page, query, filters)) - .asObservableSuccess() + return Observable.defer { + try { + client.newCall(searchMangaRequest(page, query, filters)).asObservableSuccess() + } catch (e: NoClassDefFoundError) { + // RxJava doesn't handle Errors, which tends to happen during global searches + // if an old extension using non-existent classes is still around + throw RuntimeException(e) + } + } .map { response -> searchMangaParse(response) }