diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java index 1a8993258..4b421ae32 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java @@ -218,6 +218,9 @@ public class MediaActivity extends SimpleActivity final int pathIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA); do { final String curPath = cursor.getString(pathIndex); + if (curPath == null) + continue; + if (curPath.matches(pattern) && !mToBeDeleted.contains(curPath)) { final File file = new File(curPath); if (file.exists()) { 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 7c2f003dc..2b9429ba6 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java @@ -384,6 +384,9 @@ public class ViewPagerActivity extends SimpleActivity final int pathIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA); do { final String curPath = cursor.getString(pathIndex); + if (curPath == null) + continue; + if (curPath.matches(pattern) && !curPath.equals(mToBeDeleted) && !curPath.equals(mBeingDeleted)) { final int dateIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATE_TAKEN); final long timestamp = cursor.getLong(dateIndex);