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