mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Prevent crash
This commit is contained in:
parent
e3413d4c69
commit
9db851be98
1 changed files with 42 additions and 29 deletions
|
@ -4190,21 +4190,28 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
String thread = args.getString("thread");
|
||||
long id = args.getLong("id");
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
EntityAccount account = db.account().getAccount(aid);
|
||||
if (account != null && account.color != null)
|
||||
args.putInt("color", account.color);
|
||||
|
||||
EntityFolder trash = db.folder().getFolderByType(aid, EntityFolder.TRASH);
|
||||
EntityFolder archive = db.folder().getFolderByType(aid, EntityFolder.ARCHIVE);
|
||||
|
||||
List<EntityMessage> messages = db.message().getMessagesByThread(
|
||||
aid, thread, threading ? null : id, null);
|
||||
EntityAccount account;
|
||||
EntityFolder trash;
|
||||
EntityFolder archive;
|
||||
|
||||
boolean trashable = false;
|
||||
boolean snoozable = false;
|
||||
boolean archivable = false;
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
account = db.account().getAccount(aid);
|
||||
if (account != null && account.color != null)
|
||||
args.putInt("color", account.color);
|
||||
|
||||
trash = db.folder().getFolderByType(aid, EntityFolder.TRASH);
|
||||
archive = db.folder().getFolderByType(aid, EntityFolder.ARCHIVE);
|
||||
|
||||
List<EntityMessage> messages = db.message().getMessagesByThread(
|
||||
aid, thread, threading ? null : id, null);
|
||||
|
||||
for (EntityMessage message : messages) {
|
||||
EntityFolder folder = db.folder().getFolder(message.folder);
|
||||
|
||||
|
@ -4227,8 +4234,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
archivable = true;
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
return new Boolean[]{
|
||||
trash == null || account.protocol == EntityAccount.TYPE_POP,
|
||||
trash == null ||
|
||||
(account != null && account.protocol == EntityAccount.TYPE_POP),
|
||||
trashable,
|
||||
snoozable,
|
||||
archivable && archive != null};
|
||||
|
|
Loading…
Reference in a new issue