diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-01-27 13:15:24 +0100 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-01-27 13:15:24 +0100 |
commit | 5a1187b7816f108d514eb718993553d38b66ea54 (patch) | |
tree | 0172e9d22ba716034120c27bfbaed373f480c581 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui | |
parent | 3b23a71209b3c5acdc9d34351d1731184eea8aca (diff) | |
download | open-keychain-5a1187b7816f108d514eb718993553d38b66ea54.tar.gz open-keychain-5a1187b7816f108d514eb718993553d38b66ea54.tar.bz2 open-keychain-5a1187b7816f108d514eb718993553d38b66ea54.zip |
Fix nullpointer in ImportKeysActivity
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java index e72e265d4..6638c9944 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -115,6 +115,12 @@ public class ImportKeysActivity extends BaseActivity { extras = new Bundle(); } + if (action == null) { + startCloudFragment(savedInstanceState, null, false); + startListFragment(savedInstanceState, null, null, null); + return; + } + if (Intent.ACTION_VIEW.equals(action)) { // Android's Action when opening file associated to Keychain (see AndroidManifest.xml) // delegate action to ACTION_IMPORT_KEY @@ -122,8 +128,8 @@ public class ImportKeysActivity extends BaseActivity { } switch (action) { - case ACTION_IMPORT_KEY: - /* Keychain's own Actions */ + case ACTION_IMPORT_KEY: { + /* Keychain's own Actions */ startFileFragment(savedInstanceState); if (dataUri != null) { @@ -136,16 +142,17 @@ public class ImportKeysActivity extends BaseActivity { startListFragment(savedInstanceState, importData, null, null); } break; + } case ACTION_IMPORT_KEY_FROM_KEYSERVER: 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 if (extras.containsKey(EXTRA_PENDING_INTENT_DATA)) { mPendingIntentData = extras.getParcelable(EXTRA_PENDING_INTENT_DATA); } if (extras.containsKey(EXTRA_QUERY) || extras.containsKey(EXTRA_KEY_ID)) { - /* simple search based on query or key id */ + /* simple search based on query or key id */ String query = null; if (extras.containsKey(EXTRA_QUERY)) { @@ -168,10 +175,10 @@ public class ImportKeysActivity extends BaseActivity { return; } } else if (extras.containsKey(EXTRA_FINGERPRINT)) { - /* - * search based on fingerprint, here we can enforce a check in the end - * if the right key has been downloaded - */ + /* + * search based on fingerprint, here we can enforce a check in the end + * if the right key has been downloaded + */ String fingerprint = extras.getString(EXTRA_FINGERPRINT); if (isFingerprintValid(fingerprint)) { @@ -191,21 +198,24 @@ public class ImportKeysActivity extends BaseActivity { return; } break; - case ACTION_IMPORT_KEY_FROM_FILE: + } + case ACTION_IMPORT_KEY_FROM_FILE: { // NOTE: this only displays the appropriate fragment, no actions are taken startFileFragment(savedInstanceState); // no immediate actions! startListFragment(savedInstanceState, null, null, null); 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 startFileFragment(savedInstanceState); // no immediate actions! startListFragment(savedInstanceState, null, null, null); break; - case ACTION_IMPORT_KEY_FROM_NFC: + } + case ACTION_IMPORT_KEY_FROM_NFC: { // NOTE: this only displays the appropriate fragment, no actions are taken startFileFragment(savedInstanceState); // TODO!!!!! @@ -213,14 +223,15 @@ public class ImportKeysActivity extends BaseActivity { // no immediate actions! startListFragment(savedInstanceState, null, null, null); break; - default: + } + default: { startCloudFragment(savedInstanceState, null, false); startListFragment(savedInstanceState, null, null, null); break; + } } } - private void startListFragment(Bundle savedInstanceState, byte[] bytes, Uri dataUri, String serverQuery) { // However, if we're being restored from a previous state, // then we don't need to do anything and should return or else |