diff options
author | Marco Nelissen <marcone@google.com> | 2015-02-18 00:40:19 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-02-18 00:40:19 +0000 |
commit | 8c98b8eb68cb2d318689879ed04948055ed70d08 (patch) | |
tree | 63f75bd7aaf48449487dafef0bc571554aa34335 /core/java/android/provider | |
parent | 6868e78180b4230436886cc1cf4c915736b16e2e (diff) | |
parent | 2fddfea3e5311bb5503d148d7ad18240a13ee033 (diff) | |
download | frameworks_base-8c98b8eb68cb2d318689879ed04948055ed70d08.zip frameworks_base-8c98b8eb68cb2d318689879ed04948055ed70d08.tar.gz frameworks_base-8c98b8eb68cb2d318689879ed04948055ed70d08.tar.bz2 |
am 2fddfea3: am a3404263: am 2f71ee24: am ffaee8bd: Merge "Fix NPE" into lmp-mr1-dev
* commit '2fddfea3e5311bb5503d148d7ad18240a13ee033':
Fix NPE
Diffstat (limited to 'core/java/android/provider')
-rw-r--r-- | core/java/android/provider/MediaStore.java | 23 |
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) { |