diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index 9cfcc2539..2fcb40693 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -1530,6 +1530,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 @@ -1557,7 +1561,7 @@ public class LocalStore extends Store implements Serializable { @Override public int getFlaggedMessageCount() throws MessagingException { - if (!isOpen()) { + if (mFolderId == -1) { open(OpenMode.READ_WRITE); }