Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4579d5c5 authored by Adam Cohen's avatar Adam Cohen Committed by Android Git Automerger
Browse files

am c8d31ff2: Add null check for empty MediaStore cursor

* commit 'c8d31ff2':
  Add null check for empty MediaStore cursor
parents f49a3e30 c8d31ff2
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -674,13 +674,16 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
                new String[] { MediaStore.Images.ImageColumns._ID,
                    MediaStore.Images.ImageColumns.DATE_TAKEN},
                null, null, MediaStore.Images.ImageColumns.DATE_TAKEN + " DESC LIMIT 1");

        Bitmap thumb = null;
        if (cursor != null) {
            if (cursor.moveToNext()) {
                int id = cursor.getInt(0);
                thumb = MediaStore.Images.Thumbnails.getThumbnail(getContentResolver(),
                        id, MediaStore.Images.Thumbnails.MINI_KIND, null);
            }
            cursor.close();
        }
        return thumb;
    }