]> granicus.if.org Git - neomutt/commitdiff
check for null pointer
authorRichard Russon <rich@flatcap.org>
Wed, 28 Mar 2018 01:36:40 +0000 (02:36 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 28 Mar 2018 02:28:01 +0000 (03:28 +0100)
ncrypt/pgpkey.c

index 3024e229b4105cd788acc96b6b545d116b16dafb..e6ff36e29b279f7e40af231ea351748ef94e63be 100644 (file)
@@ -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);