1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

Don't crash when being started by an old unread widget intent

This commit is contained in:
cketti 2013-03-31 01:35:38 +01:00
parent 33a2b05701
commit 48c3fbd2ba

View File

@ -427,6 +427,18 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
mSearch.addAllowedFolder(mMessageReference.folderName); mSearch.addAllowedFolder(mMessageReference.folderName);
} }
if (mSearch == null) {
// We've most likely been started by an old unread widget
String accountUuid = intent.getStringExtra("account");
String folderName = intent.getStringExtra("folder");
mSearch = new LocalSearch(folderName);
mSearch.addAccountUuid(accountUuid);
if (folderName != null) {
mSearch.addAllowedFolder(folderName);
}
}
String[] accountUuids = mSearch.getAccountUuids(); String[] accountUuids = mSearch.getAccountUuids();
mSingleAccountMode = (accountUuids.length == 1 && !mSearch.searchAllAccounts()); mSingleAccountMode = (accountUuids.length == 1 && !mSearch.searchAllAccounts());
mSingleFolderMode = mSingleAccountMode && (mSearch.getFolderNames().size() == 1); mSingleFolderMode = mSingleAccountMode && (mSearch.getFolderNames().size() == 1);