prevent ArrayIndexOutOfBoundsException

This commit is contained in:
Milos Kozak 2021-01-07 11:16:41 +01:00
parent 5d53029b54
commit 83324c97a7

View file

@ -275,8 +275,10 @@ class MainActivity : NoSplashAppCompatActivity() {
} }
private fun setPluginPreferenceMenuName() { private fun setPluginPreferenceMenuName() {
val plugin = (main_pager.adapter as TabPageAdapter).getPluginAt(main_pager.currentItem) if (main_pager.currentItem > 0) {
this.menu?.findItem(R.id.nav_plugin_preferences)?.title = resourceHelper.gs(R.string.nav_preferences_plugin, plugin.name) val plugin = (main_pager.adapter as TabPageAdapter).getPluginAt(main_pager.currentItem)
this.menu?.findItem(R.id.nav_plugin_preferences)?.title = resourceHelper.gs(R.string.nav_preferences_plugin, plugin.name)
}
} }
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {