From e97f9b1db875bb900a5b5af779c0d5d585744147 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 14 Jun 2016 10:12:03 +0200 Subject: [PATCH] avoid arrayoutofbounds when deleting the last photo --- .../simplemobiletools/gallery/activities/ViewPagerActivity.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java index 95ee30d7b..c75f3367f 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java @@ -337,6 +337,8 @@ public class ViewPagerActivity extends AppCompatActivity } private Medium getCurrentMedium() { + if (pos >= media.size()) + pos = media.size() - 1; return media.get(pos); }