]> granicus.if.org Git - neomutt/commitdiff
fix pointer checks in generate_body()
authorRichard Russon <rich@flatcap.org>
Thu, 19 Sep 2019 20:07:23 +0000 (21:07 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 21 Sep 2019 17:04:28 +0000 (18:04 +0100)
send.c

diff --git a/send.c b/send.c
index 9d8c9458b6e1366cf8fc52d3255ae1798323909a..95b35a4ae7fa19beed9ab7db7bd520f35281aa21 100644 (file)
--- a/send.c
+++ b/send.c
@@ -1097,7 +1097,9 @@ static int generate_body(FILE *fp_tmp, struct Email *e, SendFlags flags,
     if (ans == MUTT_YES)
     {
       mutt_message(_("Including quoted message..."));
-      if (!single)
+      if (single && en)
+        include_reply(m, en->email, fp_tmp);
+      else
       {
         STAILQ_FOREACH(en, el, entries)
         {
@@ -1109,8 +1111,6 @@ static int generate_body(FILE *fp_tmp, struct Email *e, SendFlags flags,
           fputc('\n', fp_tmp);
         }
       }
-      else
-        include_reply(m, en->email, fp_tmp);
     }
   }
   else if (flags & SEND_FORWARD)
@@ -1126,7 +1126,7 @@ static int generate_body(FILE *fp_tmp, struct Email *e, SendFlags flags,
       while (last && last->next)
         last = last->next;
 
-      if (single)
+      if (single && en)
       {
         tmp = mutt_make_message_attach(m, en->email, false);
         if (last)
@@ -1152,7 +1152,7 @@ static int generate_body(FILE *fp_tmp, struct Email *e, SendFlags flags,
         }
       }
     }
-    else if (ans != MUTT_ABORT)
+    else if ((ans != MUTT_ABORT) && en)
     {
       if (mutt_inline_forward(m, e, en->email, fp_tmp) != 0)
         return -1;