diff options
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java index decd1757f..4bfca9e1d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java @@ -157,8 +157,8 @@ public class PassphraseDialogActivity extends FragmentActivity { /* Get key type for message */ // find a master key id for our key - long masterKeyId = new ProviderHelper(getActivity()).getMasterKeyId(mSubKeyId); - CachedPublicKeyRing keyRing = new ProviderHelper(getActivity()).getCachedPublicKeyRing(masterKeyId); + long masterKeyId = new ProviderHelper(activity).getMasterKeyId(mSubKeyId); + CachedPublicKeyRing keyRing = new ProviderHelper(activity).getCachedPublicKeyRing(masterKeyId); // get the type of key (from the database) CanonicalizedSecretKey.SecretKeyType keyType = keyRing.getSecretKeyType(mSubKeyId); switch (keyType) { @@ -324,6 +324,11 @@ public class PassphraseDialogActivity extends FragmentActivity { } private void finishCaching(String passphrase) { + // any indication this isn't needed anymore, don't do it. + if (mIsCancelled || getActivity() == null) { + return; + } + if (mServiceIntent != null) { // TODO: Not routing passphrase through OpenPGP API currently // due to security concerns... @@ -352,6 +357,10 @@ public class PassphraseDialogActivity extends FragmentActivity { public void onDismiss(DialogInterface dialog) { super.onDismiss(dialog); + if (getActivity() == null) { + return; + } + hideKeyboard(); getActivity().setResult(RESULT_CANCELED); |