Fix MessageList crash when required Intent extras are missing
@@ -472,15 +472,23 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
}
if (search == null) {
- // We've most likely been started by an old unread widget
String accountUuid = intent.getStringExtra("account");
+ if (accountUuid != null) {
+ // We've most likely been started by an old unread widget
String folderServerId = intent.getStringExtra("folder");
search = new LocalSearch(folderServerId);
- search.addAccountUuid((accountUuid == null) ? "invalid" : accountUuid);
+ search.addAccountUuid(accountUuid);
if (folderServerId != null) {
search.addAllowedFolder(folderServerId);
}
+ } else {
+ if (BuildConfig.DEBUG) {
+ throw new AssertionError("MessageList started without required extras");
+ }
+
+ search = SearchAccount.createUnifiedInboxAccount().getRelatedSearch();
+ }
}
initializeFromLocalSearch(search);
