From c2e5470da72acdfa56d9323a9cf6844d016168a9 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 9 Jul 2020 18:52:09 +0200 Subject: [PATCH] prevent ArrayIndexOutOfBoundsException --- app/src/main/java/info/nightscout/androidaps/MainActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt index e54addbf71..b79c2a1b0b 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt @@ -146,7 +146,7 @@ class MainActivity : NoSplashAppCompatActivity() { } private fun checkPluginPreferences(viewPager: ViewPager2) { - pluginPreferencesMenuItem?.isEnabled = (viewPager.adapter as TabPageAdapter).getPluginAt(viewPager.currentItem).preferencesId != -1 + if (viewPager.currentItem > 0) pluginPreferencesMenuItem?.isEnabled = (viewPager.adapter as TabPageAdapter).getPluginAt(viewPager.currentItem).preferencesId != -1 } override fun onPostCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {