From 66ef1ccf32f60fd9ca1ec50275750f1cfcc8b352 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Wed, 10 May 2023 20:50:13 +0200 Subject: [PATCH] debug: Debug index out of bound exception. --- .../apps/readerforselfossv2/android/ReaderActivity.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ReaderActivity.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ReaderActivity.kt index 8ca576d..b384fd5 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ReaderActivity.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ReaderActivity.kt @@ -71,7 +71,12 @@ class ReaderActivity : AppCompatActivity(), DIAware { finish() } - readItem(allItems[currentItem]) + try { + readItem(allItems[currentItem]) + } catch (e: IndexOutOfBoundsException) { + e.sendSilentlyWithAcraWithName("out of bound > size = ${allItems.size} currentItem = $currentItem") + finish() + } binding.pager.adapter = ScreenSlidePagerAdapter(this) binding.pager.setCurrentItem(currentItem, false)