From 34e4dabea9165f1cbad0b5efb21ffbf7a6348d39 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 3 Oct 2014 02:07:09 +0200 Subject: [PATCH] fix nullpointer with subtle attention seeker --- .../keychain/ui/DecryptActivity.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 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..7789ca9c4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -76,10 +76,15 @@ 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 tadaTask = new AsyncTask() { + // if it's null, nothing to do here /o/ + if (clipboardText == null) { + return; + } + + new AsyncTask() { @Override protected Boolean doInBackground(Void... params) { @@ -104,11 +109,7 @@ public class DecryptActivity extends DrawerActivity { SubtleAttentionSeeker.tada(findViewById(R.id.clipboard_icon), 1.5f).start(); } } - }; - - if (clipboardText != null) { - tadaTask.execute(); - } + }.execute(); } }