From f03a7d0335a675e9651d67b79094736d0527f5a2 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 23 Feb 2020 08:58:15 +0100 Subject: [PATCH] Check for no PGP sign key selected --- app/src/main/java/eu/faircode/email/FragmentCompose.java | 2 ++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index b8f46b17e3..4f1ede186a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -1927,6 +1927,8 @@ public class FragmentCompose extends FragmentBase { } } else if (OpenPgpApi.ACTION_GET_SIGN_KEY_ID.equals(data.getAction())) { pgpSignKeyId = result.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, -1); + if (pgpSignKeyId == 0) + throw new IllegalArgumentException(context.getString(R.string.title_no_sign_key)); db.identity().setIdentitySignKey(identity.id, pgpSignKeyId); // Get public key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index be323beb41..62f7528aeb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -814,6 +814,7 @@ Transferring to OpenKeychain Verify the signature to show the message text Message is not signed or encrypted + No sign key selected Reset sign key Message not signed