am 4358731c: Merge change 22534 into eclair

Merge commit '4358731c98929e2d5af70b0c4983a872386569bd' into eclair-plus-aosp

* commit '4358731c98929e2d5af70b0c4983a872386569bd':
  ContactsContract: Fix null pointer exception in openContactPhotoInputStream()
This commit is contained in:
Mike Lockwood
2009-08-24 18:22:44 -07:00
committed by Android Git Automerger

View File

@ -343,7 +343,7 @@ public final class ContactsContract {
Cursor cursor = cr.query(photoUri,
new String[]{ContactsContract.CommonDataKinds.Photo.PHOTO}, null, null, null);
try {
if (!cursor.moveToNext()) {
if (cursor == null || !cursor.moveToNext()) {
return null;
}
byte[] data = cursor.getBlob(0);
@ -352,7 +352,9 @@ public final class ContactsContract {
}
return new ByteArrayInputStream(data);
} finally {
cursor.close();
if (cursor != null) {
cursor.close();
}
}
}
}