Added fail safe

pull/194/merge
M66B 3 years ago
parent 1e9b75e245
commit 66675c0d1a

@ -254,11 +254,13 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie
Drawable avatar = null; Drawable avatar = null;
Uri lookupUri = ContactInfo.getLookupUri(parsed); Uri lookupUri = ContactInfo.getLookupUri(parsed);
if (lookupUri != null) { if (lookupUri != null)
InputStream is = ContactsContract.Contacts.openContactPhotoInputStream( try (InputStream is = ContactsContract.Contacts.openContactPhotoInputStream(
context.getContentResolver(), lookupUri, false); context.getContentResolver(), lookupUri, false)) {
avatar = Drawable.createFromStream(is, email); avatar = Drawable.createFromStream(is, email);
} } catch (Throwable ex) {
Log.e(ex);
}
String e = parsed[0].getAddress(); String e = parsed[0].getAddress();
String p = parsed[0].getPersonal(); String p = parsed[0].getPersonal();

Loading…
Cancel
Save