From 5a625a338873d42752571548a4c626c729d52c4b Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 9 Feb 2017 21:03:47 +0100 Subject: [PATCH] add a null check to viewpager menu items --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index df2a26d68..4a0eb5350 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -100,6 +100,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } override fun onOptionsItemSelected(item: MenuItem): Boolean { + if (getCurrentMedium() == null) + return true + when (item.itemId) { R.id.menu_set_as_wallpaper -> setAsWallpaper(getCurrentFile()) R.id.menu_copy_move -> displayCopyDialog()