Merge "Prevent NPE in ContactsContract"

This commit is contained in:
Makoto Onuki
2016-02-05 21:30:38 +00:00
committed by Android (Google) Code Review

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
}