add a couple more path null checks

This commit is contained in:
tibbi 2016-11-06 15:38:34 +01:00
parent 657b14fdb4
commit 3f756369f2
2 changed files with 6 additions and 0 deletions

View file

@ -218,6 +218,9 @@ public class MediaActivity extends SimpleActivity
final int pathIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA); final int pathIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA);
do { do {
final String curPath = cursor.getString(pathIndex); final String curPath = cursor.getString(pathIndex);
if (curPath == null)
continue;
if (curPath.matches(pattern) && !mToBeDeleted.contains(curPath)) { if (curPath.matches(pattern) && !mToBeDeleted.contains(curPath)) {
final File file = new File(curPath); final File file = new File(curPath);
if (file.exists()) { if (file.exists()) {

View file

@ -384,6 +384,9 @@ public class ViewPagerActivity extends SimpleActivity
final int pathIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA); final int pathIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA);
do { do {
final String curPath = cursor.getString(pathIndex); final String curPath = cursor.getString(pathIndex);
if (curPath == null)
continue;
if (curPath.matches(pattern) && !curPath.equals(mToBeDeleted) && !curPath.equals(mBeingDeleted)) { if (curPath.matches(pattern) && !curPath.equals(mToBeDeleted) && !curPath.equals(mBeingDeleted)) {
final int dateIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATE_TAKEN); final int dateIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATE_TAKEN);
final long timestamp = cursor.getLong(dateIndex); final long timestamp = cursor.getLong(dateIndex);