From 6dc132325217d5de165fb66d23ba93b59906abe0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 6 Jun 2017 22:26:35 +0200 Subject: [PATCH] correcting a check at getting current medium at viewpager --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d92ed325a..a91695969 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -509,7 +509,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun getCurrentMedium(): Medium? { - return if (mMedia.isEmpty() || mPos >= mMedia.size) + return if (mMedia.isEmpty() || mPos == -1) null else mMedia[Math.min(mPos, mMedia.size - 1)]