Fix nullpointer in ImportKeysActivity

This commit is contained in:
Dominik Schürmann 2015-01-27 13:15:24 +01:00
parent 3b23a71209
commit 5a1187b781

View File

@ -115,6 +115,12 @@ public class ImportKeysActivity extends BaseActivity {
extras = new Bundle(); extras = new Bundle();
} }
if (action == null) {
startCloudFragment(savedInstanceState, null, false);
startListFragment(savedInstanceState, null, null, null);
return;
}
if (Intent.ACTION_VIEW.equals(action)) { if (Intent.ACTION_VIEW.equals(action)) {
// Android's Action when opening file associated to Keychain (see AndroidManifest.xml) // Android's Action when opening file associated to Keychain (see AndroidManifest.xml)
// delegate action to ACTION_IMPORT_KEY // delegate action to ACTION_IMPORT_KEY
@ -122,7 +128,7 @@ public class ImportKeysActivity extends BaseActivity {
} }
switch (action) { switch (action) {
case ACTION_IMPORT_KEY: case ACTION_IMPORT_KEY: {
/* Keychain's own Actions */ /* Keychain's own Actions */
startFileFragment(savedInstanceState); startFileFragment(savedInstanceState);
@ -136,9 +142,10 @@ public class ImportKeysActivity extends BaseActivity {
startListFragment(savedInstanceState, importData, null, null); startListFragment(savedInstanceState, importData, null, null);
} }
break; break;
}
case ACTION_IMPORT_KEY_FROM_KEYSERVER: case ACTION_IMPORT_KEY_FROM_KEYSERVER:
case ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN_TO_SERVICE: case ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN_TO_SERVICE:
case ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN_RESULT: case ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN_RESULT: {
// only used for OpenPgpService // only used for OpenPgpService
if (extras.containsKey(EXTRA_PENDING_INTENT_DATA)) { if (extras.containsKey(EXTRA_PENDING_INTENT_DATA)) {
@ -191,21 +198,24 @@ public class ImportKeysActivity extends BaseActivity {
return; return;
} }
break; break;
case ACTION_IMPORT_KEY_FROM_FILE: }
case ACTION_IMPORT_KEY_FROM_FILE: {
// NOTE: this only displays the appropriate fragment, no actions are taken // NOTE: this only displays the appropriate fragment, no actions are taken
startFileFragment(savedInstanceState); startFileFragment(savedInstanceState);
// no immediate actions! // no immediate actions!
startListFragment(savedInstanceState, null, null, null); startListFragment(savedInstanceState, null, null, null);
break; break;
case ACTION_IMPORT_KEY_FROM_FILE_AND_RETURN: }
case ACTION_IMPORT_KEY_FROM_FILE_AND_RETURN: {
// NOTE: this only displays the appropriate fragment, no actions are taken // NOTE: this only displays the appropriate fragment, no actions are taken
startFileFragment(savedInstanceState); startFileFragment(savedInstanceState);
// no immediate actions! // no immediate actions!
startListFragment(savedInstanceState, null, null, null); startListFragment(savedInstanceState, null, null, null);
break; break;
case ACTION_IMPORT_KEY_FROM_NFC: }
case ACTION_IMPORT_KEY_FROM_NFC: {
// NOTE: this only displays the appropriate fragment, no actions are taken // NOTE: this only displays the appropriate fragment, no actions are taken
startFileFragment(savedInstanceState); startFileFragment(savedInstanceState);
// TODO!!!!! // TODO!!!!!
@ -213,13 +223,14 @@ public class ImportKeysActivity extends BaseActivity {
// no immediate actions! // no immediate actions!
startListFragment(savedInstanceState, null, null, null); startListFragment(savedInstanceState, null, null, null);
break; break;
default: }
default: {
startCloudFragment(savedInstanceState, null, false); startCloudFragment(savedInstanceState, null, false);
startListFragment(savedInstanceState, null, null, null); startListFragment(savedInstanceState, null, null, null);
break; break;
} }
} }
}
private void startListFragment(Bundle savedInstanceState, byte[] bytes, Uri dataUri, String serverQuery) { private void startListFragment(Bundle savedInstanceState, byte[] bytes, Uri dataUri, String serverQuery) {
// However, if we're being restored from a previous state, // However, if we're being restored from a previous state,