]> granicus.if.org Git - mutt/commitdiff
Fix a segmentation fault which would occur when pgp_sort_keys is set
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 29 May 2003 17:47:10 +0000 (17:47 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 29 May 2003 17:47:10 +0000 (17:47 +0000)
in a configuration file, but mutt is compiled without PGP support.

init.c

diff --git a/init.c b/init.c
index 557eb0980883c29f884224da0b34b11734411920..ab283524a594579fd28e01b03c3cc263aae1ce4a 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1173,7 +1173,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
     }
     else if (DTYPE (MuttVars[idx].type) == DT_SORT)
     {
-      const struct mapping_t *map;
+      const struct mapping_t *map = NULL;
 
       switch (MuttVars[idx].type & DT_SUBTYPE_MASK)
       {
@@ -1195,6 +1195,13 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
          break;
       }
 
+      if (!map)
+      {
+       snprintf (err->data, err->dsize, _("%s: Unknown type."), MuttVars[idx].option);
+       r = -1;
+       break;
+      }
+      
       if (query || *s->dptr != '=')
       {
        p = mutt_getnamebyvalue (*((short *) MuttVars[idx].data) & SORT_MASK, map);