mirror of
https://github.com/pachli/pachli-android.git
synced 2025-01-31 17:44:51 +01:00
fix: Don't show "Remove tab" menu if there are no tabs (#1179)
Prevents a crash that would otherwise occur.
This commit is contained in:
parent
a66da06c2c
commit
ed77d7aeb3
@ -482,7 +482,9 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider {
|
||||
override fun onPrepareMenu(menu: Menu) {
|
||||
super<BottomSheetActivity>.onPrepareMenu(menu)
|
||||
|
||||
menu.findItem(R.id.action_remove_tab).isVisible = tabAdapter.tabs.getOrNull(binding.viewPager.currentItem)?.timeline != Timeline.Home
|
||||
menu.findItem(R.id.action_remove_tab).isVisible = tabAdapter.tabs.getOrNull(binding.viewPager.currentItem)?.let {
|
||||
it.timeline != Timeline.Home
|
||||
} ?: false
|
||||
|
||||
// If the main toolbar is hidden then there's no space in the top/bottomNav to show
|
||||
// the menu items as icons, so forceably disable them
|
||||
|
Loading…
x
Reference in New Issue
Block a user