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
1 changed files with 12 additions and 0 deletions

View File

@ -427,6 +427,18 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
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();
mSingleAccountMode = (accountUuids.length == 1 && !mSearch.searchAllAccounts());
mSingleFolderMode = mSingleAccountMode && (mSearch.getFolderNames().size() == 1);