am b65a90d7: Merge change I73b00501 into eclair-mr2

Merge commit 'b65a90d76ff486208974f0b1dac8e880ba29174b' into eclair-mr2-plus-aosp

* commit 'b65a90d76ff486208974f0b1dac8e880ba29174b':
  Check cursor and URI value for nullity to prevent NPE.
This commit is contained in:
Ray Chen
2009-10-13 10:50:30 -07:00
committed by Android Git Automerger

View File

@@ -459,6 +459,7 @@ public class ThumbnailUtil {
Cursor c = cr.query(thumbUri, THUMB_PROJECTION,
Thumbnails.IMAGE_ID + "=?",
new String[]{String.valueOf(origId)}, null);
if (c == null) return null;
try {
if (c.moveToNext()) {
return ContentUris.withAppendedId(thumbUri, c.getLong(0));
@@ -487,6 +488,7 @@ public class ThumbnailUtil {
if (thumb == null) return false;
try {
Uri uri = getImageThumbnailUri(cr, origId, thumb.getWidth(), thumb.getHeight());
if (uri == null) return false;
OutputStream thumbOut = cr.openOutputStream(uri);
thumb.compress(Bitmap.CompressFormat.JPEG, 85, thumbOut);
thumbOut.close();