summaryrefslogtreecommitdiff
path: root/lib/openpgp/privkey.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/openpgp/privkey.c')
-rw-r--r--lib/openpgp/privkey.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/openpgp/privkey.c b/lib/openpgp/privkey.c
index 07bb9880c5..0ed4f0d7cf 100644
--- a/lib/openpgp/privkey.c
+++ b/lib/openpgp/privkey.c
@@ -1176,7 +1176,10 @@ int
gnutls_openpgp_privkey_get_preferred_key_id (gnutls_openpgp_privkey_t key,
gnutls_openpgp_keyid_t keyid)
{
- if (!key || !keyid || !key->preferred_set)
+ if (!key->preferred_set)
+ return gnutls_assert_val(GNUTLS_E_OPENPGP_PREFERRED_KEY_ERROR);
+
+ if (!key || !keyid)
{
gnutls_assert ();
return GNUTLS_E_INVALID_REQUEST;