1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Don't crash when MessageList is started with no intent extras

This commit is contained in:
cketti 2013-06-29 03:20:58 +02:00
parent 5fc39e6719
commit 85e7d4fa12

View File

@ -213,7 +213,10 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
// Enable gesture detection for MessageLists // Enable gesture detection for MessageLists
setupGestureDetector(this); setupGestureDetector(this);
decodeExtras(getIntent()); if (!decodeExtras(getIntent())) {
return;
}
findFragments(); findFragments();
initializeDisplayMode(savedInstanceState); initializeDisplayMode(savedInstanceState);
initializeLayout(); initializeLayout();
@ -244,7 +247,10 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
mSearch = null; mSearch = null;
mFolderName = null; mFolderName = null;
decodeExtras(intent); if (!decodeExtras(intent)) {
return;
}
initializeDisplayMode(null); initializeDisplayMode(null);
initializeFragments(); initializeFragments();
displayViews(); displayViews();
@ -361,7 +367,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
} }
} }
private void decodeExtras(Intent intent) { private boolean decodeExtras(Intent intent) {
String action = intent.getAction(); String action = intent.getAction();
if (Intent.ACTION_VIEW.equals(action)) { if (Intent.ACTION_VIEW.equals(action)) {
Uri uri = intent.getData(); Uri uri = intent.getData();
@ -433,7 +439,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
String folderName = intent.getStringExtra("folder"); String folderName = intent.getStringExtra("folder");
mSearch = new LocalSearch(folderName); mSearch = new LocalSearch(folderName);
mSearch.addAccountUuid(accountUuid); mSearch.addAccountUuid((accountUuid == null) ? "invalid" : accountUuid);
if (folderName != null) { if (folderName != null) {
mSearch.addAllowedFolder(folderName); mSearch.addAllowedFolder(folderName);
} }
@ -459,7 +465,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
if (mSingleAccountMode && (mAccount == null || !mAccount.isAvailable(this))) { if (mSingleAccountMode && (mAccount == null || !mAccount.isAvailable(this))) {
Log.i(K9.LOG_TAG, "not opening MessageList of unavailable account"); Log.i(K9.LOG_TAG, "not opening MessageList of unavailable account");
onAccountUnavailable(); onAccountUnavailable();
return; return false;
} }
if (mSingleFolderMode) { if (mSingleFolderMode) {
@ -468,6 +474,8 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
// now we know if we are in single account mode and need a subtitle // now we know if we are in single account mode and need a subtitle
mActionBarSubTitle.setVisibility((!mSingleFolderMode) ? View.GONE : View.VISIBLE); mActionBarSubTitle.setVisibility((!mSingleFolderMode) ? View.GONE : View.VISIBLE);
return true;
} }
@Override @Override