From: Richard Russon Date: Wed, 28 Mar 2018 01:36:40 +0000 (+0100) Subject: check for null pointer X-Git-Tag: neomutt-20180512~77^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e1b8af6480329f0846b3081f46d457b17346634b;p=neomutt check for null pointer --- diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 3024e229b..e6ff36e29 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -836,6 +836,9 @@ static struct PgpKeyInfo **pgp_get_lastp(struct PgpKeyInfo *p) struct PgpKeyInfo *pgp_getkeybyaddr(struct Address *a, short abilities, enum PgpRing keyring, int oppenc_mode) { + if (!a) + return NULL; + struct Address *r = NULL, *p = NULL; struct ListHead hints = STAILQ_HEAD_INITIALIZER(hints); @@ -848,13 +851,13 @@ struct PgpKeyInfo *pgp_getkeybyaddr(struct Address *a, short abilities, struct PgpKeyInfo **last = &matches; struct PgpUid *q = NULL; - if (a && a->mailbox) + if (a->mailbox) pgp_add_string_to_hints(&hints, a->mailbox); - if (a && a->personal) + if (a->personal) pgp_add_string_to_hints(&hints, a->personal); if (!oppenc_mode) - mutt_message(_("Looking for keys matching \"%s\"..."), a ? a->mailbox : ""); + mutt_message(_("Looking for keys matching \"%s\"..."), a->mailbox); keys = pgp_get_candidates(keyring, &hints); mutt_list_free(&hints);