add a null check to viewpager menu items

This commit is contained in:
tibbi 2017-02-09 21:03:47 +01:00
parent f728ca2650
commit 5a625a3388

View file

@ -100,6 +100,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (getCurrentMedium() == null)
return true
when (item.itemId) { when (item.itemId) {
R.id.menu_set_as_wallpaper -> setAsWallpaper(getCurrentFile()) R.id.menu_set_as_wallpaper -> setAsWallpaper(getCurrentFile())
R.id.menu_copy_move -> displayCopyDialog() R.id.menu_copy_move -> displayCopyDialog()