summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2015-02-18 00:01:16 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-02-18 00:01:16 +0000
commitd0e40040eb6cf386b89bd4e636a2f5fa58e05dd4 (patch)
tree626ad55a20f0a8e415ae0d9c82e7ad7658dad5f9 /core
parentc9f7a17ac7188ab002998d1c0c1b6c192b51e58b (diff)
parentffaee8bda9c8d22af17098fec0e6626301d91844 (diff)
downloadframeworks_base-d0e40040eb6cf386b89bd4e636a2f5fa58e05dd4.zip
frameworks_base-d0e40040eb6cf386b89bd4e636a2f5fa58e05dd4.tar.gz
frameworks_base-d0e40040eb6cf386b89bd4e636a2f5fa58e05dd4.tar.bz2
am ffaee8bd: Merge "Fix NPE" into lmp-mr1-dev
* commit 'ffaee8bda9c8d22af17098fec0e6626301d91844': Fix NPE
Diffstat (limited to 'core')
-rw-r--r--core/java/android/provider/MediaStore.java23
1 files changed, 11 insertions, 12 deletions
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index 736ec54..5afbd6d 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -638,7 +638,6 @@ public final class MediaStore {
static Bitmap getThumbnail(ContentResolver cr, long origId, long groupId, int kind,
BitmapFactory.Options options, Uri baseUri, boolean isVideo) {
Bitmap bitmap = null;
- String filePath = null;
// Log.v(TAG, "getThumbnail: origId="+origId+", kind="+kind+", isVideo="+isVideo);
// If the magic is non-zero, we simply return thumbnail if it does exist.
// querying MediaProvider and simply return thumbnail.
@@ -710,18 +709,18 @@ public final class MediaStore {
Uri uri = Uri.parse(
baseUri.buildUpon().appendPath(String.valueOf(origId))
.toString().replaceFirst("thumbnails", "media"));
- if (filePath == null) {
- if (c != null) c.close();
- c = cr.query(uri, PROJECTION, null, null, null);
- if (c == null || !c.moveToFirst()) {
- return null;
- }
- filePath = c.getString(1);
+ if (c != null) c.close();
+ c = cr.query(uri, PROJECTION, null, null, null);
+ if (c == null || !c.moveToFirst()) {
+ return null;
}
- if (isVideo) {
- bitmap = ThumbnailUtils.createVideoThumbnail(filePath, kind);
- } else {
- bitmap = ThumbnailUtils.createImageThumbnail(filePath, kind);
+ String filePath = c.getString(1);
+ if (filePath != null) {
+ if (isVideo) {
+ bitmap = ThumbnailUtils.createVideoThumbnail(filePath, kind);
+ } else {
+ bitmap = ThumbnailUtils.createImageThumbnail(filePath, kind);
+ }
}
}
} catch (SQLiteException ex) {