From 2b5e8241abaf118f96b5f16bdfad67d58d207685 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 8 Jan 2022 16:15:02 -0500 Subject: [PATCH] Fix more crashes --- .../network/interceptor/CloudflareInterceptor.kt | 2 +- .../java/eu/kanade/tachiyomi/ui/manga/MangaController.kt | 2 +- .../tachiyomi/ui/manga/info/MangaFullCoverDialog.kt | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt index 6aabb98792..37c8e920d2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt @@ -42,7 +42,7 @@ class CloudflareInterceptor(private val context: Context) : Interceptor { // Crashes on some devices. We skip this in some cases since the only impact is slower // WebView init in those rare cases. // See https://bugs.chromium.org/p/chromium/issues/detail?id=1279562 - if (Build.VERSION.SDK_INT == Build.VERSION_CODES.S && DeviceUtil.isSamsung) { + if (DeviceUtil.isMiui || Build.VERSION.SDK_INT == Build.VERSION_CODES.S && DeviceUtil.isSamsung) { return@lazy } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index e59181bc2e..f4adb3c910 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -339,7 +339,7 @@ class MangaController : private fun updateToolbarTitleAlpha(@FloatRange(from = 0.0, to = 1.0) alpha: Float? = null) { // Controller may actually already be destroyed by the time this gets run - binding ?: return + if (!isAttached) return val scrolledList = binding.fullRecycler ?: binding.infoRecycler!! (activity as? MainActivity)?.binding?.appbar?.titleTextAlpha = when { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaFullCoverDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaFullCoverDialog.kt index 207169c473..ac5405bb90 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaFullCoverDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaFullCoverDialog.kt @@ -33,7 +33,7 @@ class MangaFullCoverDialog : DialogController { private var disposable: Disposable? = null private val mangaController - get() = targetController as MangaController + get() = targetController as MangaController? constructor(targetController: MangaController, manga: Manga) : super(bundleOf("mangaId" to manga.id)) { this.targetController = targetController @@ -53,9 +53,9 @@ class MangaFullCoverDialog : DialogController { setNavigationOnClickListener { dialog?.dismiss() } setOnMenuItemClickListener { when (it.itemId) { - R.id.action_share_cover -> mangaController.shareCover() - R.id.action_save_cover -> mangaController.saveCover() - R.id.action_edit_cover -> mangaController.changeCover() + R.id.action_share_cover -> mangaController?.shareCover() + R.id.action_save_cover -> mangaController?.saveCover() + R.id.action_edit_cover -> mangaController?.changeCover() } true }