From 08e035747135044536d0f7d2051e031185a81129 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Wed, 27 May 2015 18:10:18 +0200 Subject: [PATCH] fix nullpointer in encrypttextactivity. fixes #1267 --- .../keychain/ui/EncryptTextActivity.java | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java index 52d098adc..82f057895 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java @@ -59,22 +59,7 @@ public class EncryptTextActivity extends BaseActivity implements } }, false); - // Handle intent actions - handleActions(getIntent(), savedInstanceState); - } - - @Override - protected void initLayout() { - setContentView(R.layout.encrypt_text_activity); - } - - - /** - * Handles all actions with this intent - * - * @param intent - */ - private void handleActions(Intent intent, Bundle savedInstanceState) { + Intent intent = getIntent(); String action = intent.getAction(); Bundle extras = intent.getExtras(); String type = intent.getType(); @@ -83,10 +68,6 @@ public class EncryptTextActivity extends BaseActivity implements extras = new Bundle(); } - /* - * Android's Action - */ - // When sending to OpenKeychain Encrypt via share menu if (Intent.ACTION_SEND.equals(action) && type != null) { Log.logDebugBundle(extras, "extras"); @@ -127,6 +108,11 @@ public class EncryptTextActivity extends BaseActivity implements } } + @Override + protected void initLayout() { + setContentView(R.layout.encrypt_text_activity); + } + @Override public void onModeChanged(boolean symmetric) { // switch fragments @@ -142,21 +128,29 @@ public class EncryptTextActivity extends BaseActivity implements @Override public void onSignatureKeyIdChanged(long signatureKeyId) { - mEncryptFragment.setSigningKeyId(signatureKeyId); + if (mEncryptFragment != null) { + mEncryptFragment.setSigningKeyId(signatureKeyId); + } } @Override public void onEncryptionKeyIdsChanged(long[] encryptionKeyIds) { - mEncryptFragment.setEncryptionKeyIds(encryptionKeyIds); + if (mEncryptFragment != null) { + mEncryptFragment.setEncryptionKeyIds(encryptionKeyIds); + } } @Override public void onEncryptionUserIdsChanged(String[] encryptionUserIds) { - mEncryptFragment.setEncryptionUserIds(encryptionUserIds); + if (mEncryptFragment != null) { + mEncryptFragment.setEncryptionUserIds(encryptionUserIds); + } } @Override public void onPassphraseChanged(Passphrase passphrase) { - mEncryptFragment.setSymmetricPassphrase(passphrase); + if (mEncryptFragment != null) { + mEncryptFragment.setSymmetricPassphrase(passphrase); + } } }