Merge change 22534 into eclair
* changes:
ContactsContract: Fix null pointer exception in openContactPhotoInputStream()
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 3a4449e..255534d 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -343,7 +343,7 @@
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 @@
}
return new ByteArrayInputStream(data);
} finally {
- cursor.close();
+ if (cursor != null) {
+ cursor.close();
+ }
}
}
}