]> granicus.if.org Git - neomutt/commitdiff
fix crash with incomplete template 1059/head
authorRichard Russon <rich@flatcap.org>
Thu, 15 Mar 2018 16:02:21 +0000 (16:02 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 15 Mar 2018 18:38:04 +0000 (18:38 +0000)
main.c

diff --git a/main.c b/main.c
index e17d9eb3f8f13bd9dff6318c854abaaba45aee64..9702b01f0eaea48fafa24722b2b7d40d01691183 100644 (file)
--- a/main.c
+++ b/main.c
@@ -792,7 +792,13 @@ int main(int argc, char **argv, char **env)
         }
         context_hdr->content->length = st.st_size;
 
-        mutt_prepare_template(fin, NULL, msg, context_hdr, 0);
+        if (mutt_prepare_template(fin, NULL, msg, context_hdr, 0) < 0)
+        {
+          mutt_error(_("Cannot parse message template: %s"), draft_file);
+          mutt_env_free(&opts_env);
+          mutt_free_header(&context_hdr);
+          goto main_curses;
+        }
 
         /* Scan for neomutt header to set ResumeDraftFiles */
         struct ListNode *np, *tmp;