Prevent NPE in ContactsContract

Bug 26730982

Change-Id: I36fdfffba79e0696175edd42bb131f92cba47499
This commit is contained in:
Makoto Onuki
2016-02-05 13:23:21 -08:00
parent e3936dcf03
commit da072b3e38

View File

@@ -2079,10 +2079,11 @@ public final class ContactsContract {
if (preferHighres) {
final Uri displayPhotoUri = Uri.withAppendedPath(contactUri,
Contacts.Photo.DISPLAY_PHOTO);
InputStream inputStream;
try {
AssetFileDescriptor fd = cr.openAssetFileDescriptor(displayPhotoUri, "r");
return fd.createInputStream();
if (fd != null) {
return fd.createInputStream();
}
} catch (IOException e) {
// fallback to the thumbnail code
}