diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index 9de4458ed..47b4b97a8 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -1521,6 +1521,10 @@ public class LocalStore extends Store implements Serializable { @Override public int getUnreadMessageCount() throws MessagingException { + if (mFolderId == -1) { + open(OpenMode.READ_WRITE); + } + try { return database.execute(false, new DbCallback() { @Override @@ -1548,7 +1552,7 @@ public class LocalStore extends Store implements Serializable { @Override public int getFlaggedMessageCount() throws MessagingException { - if (!isOpen()) { + if (mFolderId == -1) { open(OpenMode.READ_WRITE); }