From 44ee7137632c2fd8e6d97a8f05a213467ecf1dc6 Mon Sep 17 00:00:00 2001 From: Ashley Hughes Date: Sat, 8 Feb 2014 15:51:11 +0000 Subject: [PATCH] fix create keyring crash --- .../keychain/ui/EditKeyActivity.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index 66f23e22e..802d29a44 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -115,8 +115,8 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener public boolean needsSaving() { - mNeedsSaving = mUserIdsView.needsSaving(); - mNeedsSaving |= mKeysView.needsSaving(); + mNeedsSaving = (mUserIdsView == null) ? false : mUserIdsView.needsSaving(); + mNeedsSaving |= (mKeysView == null) ? false : mKeysView.needsSaving(); mNeedsSaving |= hasPassphraseChanged(); return mNeedsSaving; } @@ -515,10 +515,14 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener public boolean hasPassphraseChanged() { - if (mNoPassphrase.isChecked()) { - return mIsPassPhraseSet; - } else { - return (mNewPassPhrase != null && !mNewPassPhrase.equals("")); + if (mNoPassphrase != null) { + if (mNoPassphrase.isChecked()) { + return mIsPassPhraseSet; + } else { + return (mNewPassPhrase != null && !mNewPassPhrase.equals("")); + } + }else { + return false; } }