am 9e521c10: am 4358731c: Merge change 22534 into eclair

Merge commit '9e521c10b3ca59e170c8edc0b9b292e673e16a02'

* commit '9e521c10b3ca59e170c8edc0b9b292e673e16a02':
  ContactsContract: Fix null pointer exception in openContactPhotoInputStream()
This commit is contained in:
Mike Lockwood
2009-08-24 18:24:53 -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();
}
}
}
}