From 3f756369f26d73753712cc739376192b267a76d7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 6 Nov 2016 15:38:34 +0100 Subject: [PATCH] add a couple more path null checks --- .../simplemobiletools/gallery/activities/MediaActivity.java | 3 +++ .../gallery/activities/ViewPagerActivity.java | 3 +++ 2 files changed, 6 insertions(+) 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);