mirror of https://github.com/M66B/FairEmail.git
Prevent crash
This commit is contained in:
parent
53abb06efa
commit
4ad1bde2e3
|
@ -296,14 +296,17 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
||||||
|
|
||||||
boolean photo = false;
|
boolean photo = false;
|
||||||
if (avatars) {
|
if (avatars) {
|
||||||
if (message.avatar != null) {
|
if (message.avatar != null)
|
||||||
ContentResolver resolver = context.getContentResolver();
|
try {
|
||||||
InputStream is = ContactsContract.Contacts.openContactPhotoInputStream(resolver, Uri.parse(message.avatar));
|
ContentResolver resolver = context.getContentResolver();
|
||||||
if (is != null) {
|
InputStream is = ContactsContract.Contacts.openContactPhotoInputStream(resolver, Uri.parse(message.avatar));
|
||||||
photo = true;
|
if (is != null) {
|
||||||
ivAvatar.setImageDrawable(Drawable.createFromStream(is, "avatar"));
|
photo = true;
|
||||||
|
ivAvatar.setImageDrawable(Drawable.createFromStream(is, "avatar"));
|
||||||
|
}
|
||||||
|
} catch (SecurityException ex) {
|
||||||
|
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!photo && identicons) {
|
if (!photo && identicons) {
|
||||||
if (message.from != null && message.from.length > 0)
|
if (message.from != null && message.from.length > 0)
|
||||||
|
|
|
@ -525,6 +525,8 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
cursor.getLong(0) + "/photo");
|
cursor.getLong(0) + "/photo");
|
||||||
mbuilder.setLargeIcon(Icon.createWithContentUri(photo));
|
mbuilder.setLargeIcon(Icon.createWithContentUri(photo));
|
||||||
}
|
}
|
||||||
|
} catch (SecurityException ex) {
|
||||||
|
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||||
} finally {
|
} finally {
|
||||||
if (cursor != null)
|
if (cursor != null)
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
|
Loading…
Reference in New Issue