From b4577d667648819fc415b4dc0c0787de3d2d9eae Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 14 Apr 2021 18:03:48 -0400 Subject: [PATCH] Avoid crash when unknown reading mode is used --- .../eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index e7deac4b8..42ba04729 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -554,10 +554,14 @@ class ReaderActivity : BaseRxActivity() } private fun showReadingModeToast(mode: Int) { - val strings = resources.getStringArray(R.array.viewers_selector) - readingModeToast?.cancel() - readingModeToast = toast(strings[mode]) { - it.setGravity(Gravity.CENTER_VERTICAL or Gravity.CENTER_HORIZONTAL, 0, 0) + try { + val strings = resources.getStringArray(R.array.viewers_selector) + readingModeToast?.cancel() + readingModeToast = toast(strings[mode]) { + it.setGravity(Gravity.CENTER_VERTICAL or Gravity.CENTER_HORIZONTAL, 0, 0) + } + } catch (e: ArrayIndexOutOfBoundsException) { + Timber.e("Unknown reading mode: $mode") } }