From 3d7c136320da3b5842a51d7dbb9e82cf74144f3f Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 19 Feb 2023 16:44:58 -0500 Subject: [PATCH] Avoid crash when loading invalid extension package --- .../eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt index 7ecb4bd52..41eb2e0f6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt @@ -126,8 +126,8 @@ internal object ExtensionLoader { } // Validate lib version - val libVersion = versionName.substringBeforeLast('.').toDouble() - if (libVersion < LIB_VERSION_MIN || libVersion > LIB_VERSION_MAX) { + val libVersion = versionName.substringBeforeLast('.').toDoubleOrNull() + if (libVersion == null || libVersion < LIB_VERSION_MIN || libVersion > LIB_VERSION_MAX) { logcat(LogPriority.WARN) { "Lib version is $libVersion, while only versions " + "$LIB_VERSION_MIN to $LIB_VERSION_MAX are allowed" @@ -136,7 +136,6 @@ internal object ExtensionLoader { } val signatureHash = getSignatureHash(pkgInfo) - if (signatureHash == null) { logcat(LogPriority.WARN) { "Package $pkgName isn't signed" } return LoadResult.Error