diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-10-02 19:35:03 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-10-02 19:35:03 +0200 |
commit | a361e82a4de54fe844523db29f2b97ca28d79045 (patch) | |
tree | b53d9ef06513fd45d58f5e28c9163e8a7edb5adf /OpenKeychain/src | |
parent | b6916a9b40ab6edf6396471a966c455f6054da74 (diff) | |
download | open-keychain-a361e82a4de54fe844523db29f2b97ca28d79045.tar.gz open-keychain-a361e82a4de54fe844523db29f2b97ca28d79045.tar.bz2 open-keychain-a361e82a4de54fe844523db29f2b97ca28d79045.zip |
fix NullPointerException in keyboard hack
Diffstat (limited to 'OpenKeychain/src')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java index a89d4be1c..43f869f02 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java @@ -209,6 +209,10 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor mPassphraseEditText.post(new Runnable() { @Override public void run() { + // The activity might already be gone! Nvm in that case. + if (getActivity() == null) { + return; + } InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mPassphraseEditText, InputMethodManager.SHOW_IMPLICIT); @@ -342,13 +346,18 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor } private void hideKeyboard() { + // The activity which called the dialog might no longer exist. Nvm in that case... + if (getActivity() == null) { + return; + } InputMethodManager inputManager = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); //check if no view has focus: View v = getActivity().getCurrentFocus(); - if (v == null) + if (v == null) { return; + } inputManager.hideSoftInputFromWindow(v.getWindowToken(), 0); } |