mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-04 06:20:26 +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");
|
String thread = args.getString("thread");
|
||||||
long id = args.getLong("id");
|
long id = args.getLong("id");
|
||||||
|
|
||||||
DB db = DB.getInstance(context);
|
EntityAccount account;
|
||||||
|
EntityFolder trash;
|
||||||
EntityAccount account = db.account().getAccount(aid);
|
EntityFolder archive;
|
||||||
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);
|
|
||||||
|
|
||||||
boolean trashable = false;
|
boolean trashable = false;
|
||||||
boolean snoozable = false;
|
boolean snoozable = false;
|
||||||
boolean archivable = 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) {
|
for (EntityMessage message : messages) {
|
||||||
EntityFolder folder = db.folder().getFolder(message.folder);
|
EntityFolder folder = db.folder().getFolder(message.folder);
|
||||||
|
|
||||||
|
@ -4227,8 +4234,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
archivable = true;
|
archivable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db.setTransactionSuccessful();
|
||||||
|
} finally {
|
||||||
|
db.endTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
return new Boolean[]{
|
return new Boolean[]{
|
||||||
trash == null || account.protocol == EntityAccount.TYPE_POP,
|
trash == null ||
|
||||||
|
(account != null && account.protocol == EntityAccount.TYPE_POP),
|
||||||
trashable,
|
trashable,
|
||||||
snoozable,
|
snoozable,
|
||||||
archivable && archive != null};
|
archivable && archive != null};
|
||||||
|
|
Loading…
Reference in a new issue