Commit 8103ce9e 8103ce9ec3b9ddba5dc82348982d3e7a4a5b1db9 by Wojciech Polak

Check return code from msgset_parse to prevent segmentation fault.

1 parent ec05f285
...@@ -49,11 +49,19 @@ mail_next (int argc, char **argv) ...@@ -49,11 +49,19 @@ mail_next (int argc, char **argv)
49 else 49 else
50 { 50 {
51 msgset_t *list = NULL; 51 msgset_t *list = NULL;
52 msgset_parse (argc, argv, MSG_NODELETED|MSG_SILENT, &list); 52 int rc = msgset_parse (argc, argv, MSG_NODELETED|MSG_SILENT, &list);
53 n = list->msg_part[0]; 53 if (!rc)
54 msgset_free (list); 54 {
55 if (util_get_message (mbox, n, &msg)) 55 n = list->msg_part[0];
56 return 1; 56 msgset_free (list);
57 if (util_get_message (mbox, n, &msg))
58 return 1;
59 }
60 else
61 {
62 util_error (_("No applicable message"));
63 return 1;
64 }
57 } 65 }
58 cursor = n; 66 cursor = n;
59 util_do_command("print"); 67 util_do_command("print");
......
...@@ -49,11 +49,19 @@ mail_previous (int argc, char **argv) ...@@ -49,11 +49,19 @@ mail_previous (int argc, char **argv)
49 else 49 else
50 { 50 {
51 msgset_t *list = NULL; 51 msgset_t *list = NULL;
52 msgset_parse (argc, argv, MSG_NODELETED|MSG_SILENT, &list); 52 int rc = msgset_parse (argc, argv, MSG_NODELETED|MSG_SILENT, &list);
53 n = list->msg_part[0]; 53 if (!rc)
54 msgset_free (list); 54 {
55 if (util_get_message (mbox, n, &msg)) 55 n = list->msg_part[0];
56 return 1; 56 msgset_free (list);
57 if (util_get_message (mbox, n, &msg))
58 return 1;
59 }
60 else
61 {
62 util_error (_("No applicable message"));
63 return 1;
64 }
57 } 65 }
58 cursor = n; 66 cursor = n;
59 util_do_command ("print"); 67 util_do_command ("print");
......