Prevent crash

pull/180/head
M66B 5 years ago
parent e3413d4c69
commit 9db851be98

@ -4190,21 +4190,28 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
String thread = args.getString("thread");
long id = args.getLong("id");
EntityAccount account;
EntityFolder trash;
EntityFolder archive;
boolean trashable = false;
boolean snoozable = false;
boolean archivable = false;
DB db = DB.getInstance(context);
try {
db.beginTransaction();
EntityAccount account = db.account().getAccount(aid);
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);
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);
boolean trashable = false;
boolean snoozable = false;
boolean archivable = false;
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…
Cancel
Save