Fix MessageList crash when no account is provided in search Intent
@@ -53,6 +53,7 @@ import com.fsck.k9.search.SearchSpecification;
import com.fsck.k9.search.SearchSpecification.Attribute;
import com.fsck.k9.search.SearchSpecification.SearchCondition;
import com.fsck.k9.search.SearchSpecification.SearchField;
+import com.fsck.k9.ui.BuildConfig;
import com.fsck.k9.ui.K9Drawer;
import com.fsck.k9.ui.R;
import com.fsck.k9.ui.Theme;
@@ -437,11 +438,16 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
Bundle appData = intent.getBundleExtra(SearchManager.APP_DATA);
if (appData != null) {
- search.addAccountUuid(appData.getString(EXTRA_SEARCH_ACCOUNT));
+ String searchAccountUuid = appData.getString(EXTRA_SEARCH_ACCOUNT);
+ if (searchAccountUuid != null) {
+ search.addAccountUuid(searchAccountUuid);
// searches started from a folder list activity will provide an account, but no folder
if (appData.getString(EXTRA_SEARCH_FOLDER) != null) {
search.addAllowedFolder(appData.getString(EXTRA_SEARCH_FOLDER));
}
+ } else if (BuildConfig.DEBUG) {
+ throw new AssertionError("Invalid app data in search intent");
+ }
} else {
search.addAccountUuid(LocalSearch.ALL_ACCOUNTS);
}
