diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-10-03 02:17:51 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-10-03 02:17:51 +0200 |
commit | b9dc21969faa7c4cd7b10638a629690d0df20cf4 (patch) | |
tree | e13a7143a9ff5139b2d95098d3cdcc84844684cd /OpenKeychain | |
parent | 9a296c012d8aaaf4273892ad06a4f66ea4edefac (diff) | |
download | open-keychain-b9dc21969faa7c4cd7b10638a629690d0df20cf4.tar.gz open-keychain-b9dc21969faa7c4cd7b10638a629690d0df20cf4.tar.bz2 open-keychain-b9dc21969faa7c4cd7b10638a629690d0df20cf4.zip |
Fix nullpointer with clipboard
Diffstat (limited to 'OpenKeychain')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java | 13 | ||||
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java | 6 |
2 files changed, 9 insertions, 10 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java index ac58c63dc..5e23a24ae 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -76,20 +76,19 @@ public class DecryptActivity extends DrawerActivity { if (Build.VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) { // get text from clipboard - final String clipboardText = - ClipboardReflection.getClipboardText(DecryptActivity.this).toString(); + final CharSequence clipboardText = ClipboardReflection.getClipboardText(DecryptActivity.this); - AsyncTask<Void, Void, Boolean> tadaTask = new AsyncTask<Void, Void, Boolean>() { + AsyncTask<String, Void, Boolean> tadaTask = new AsyncTask<String, Void, Boolean>() { @Override - protected Boolean doInBackground(Void... params) { + protected Boolean doInBackground(String... clipboardText) { // see if it looks like a pgp thing - Matcher matcher = PgpHelper.PGP_MESSAGE.matcher(clipboardText); + Matcher matcher = PgpHelper.PGP_MESSAGE.matcher(clipboardText[0]); boolean animate = matcher.matches(); // see if it looks like another pgp thing if (!animate) { - matcher = PgpHelper.PGP_CLEARTEXT_SIGNATURE.matcher(clipboardText); + matcher = PgpHelper.PGP_CLEARTEXT_SIGNATURE.matcher(clipboardText[0]); animate = matcher.matches(); } return animate; @@ -107,7 +106,7 @@ public class DecryptActivity extends DrawerActivity { }; if (clipboardText != null) { - tadaTask.execute(); + tadaTask.execute(clipboardText.toString()); } } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java index 8d489b3d4..73163eabd 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java @@ -156,11 +156,11 @@ public class DecryptTextActivity extends ActionBarActivity { } else if (ACTION_DECRYPT_FROM_CLIPBOARD.equals(action)) { Log.d(Constants.TAG, "ACTION_DECRYPT_FROM_CLIPBOARD"); - String clipboardText = ClipboardReflection.getClipboardText(this).toString(); - clipboardText = getPgpContent(clipboardText); + CharSequence clipboardText = ClipboardReflection.getClipboardText(this); if (clipboardText != null) { - loadFragment(savedInstanceState, clipboardText); + String text = getPgpContent(clipboardText.toString()); + loadFragment(savedInstanceState, text); } else { returnInvalidResult(); } |