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)
else
{
msgset_t *list = NULL;
msgset_parse (argc, argv, MSG_NODELETED|MSG_SILENT, &list);
n = list->msg_part[0];
msgset_free (list);
if (util_get_message (mbox, n, &msg))
return 1;
int rc = msgset_parse (argc, argv, MSG_NODELETED|MSG_SILENT, &list);
if (!rc)
{
n = list->msg_part[0];
msgset_free (list);
if (util_get_message (mbox, n, &msg))
return 1;
}
else
{
util_error (_("No applicable message"));
return 1;
}
}
cursor = n;
util_do_command("print");
......
......@@ -49,11 +49,19 @@ mail_previous (int argc, char **argv)
else
{
msgset_t *list = NULL;
msgset_parse (argc, argv, MSG_NODELETED|MSG_SILENT, &list);
n = list->msg_part[0];
msgset_free (list);
if (util_get_message (mbox, n, &msg))
return 1;
int rc = msgset_parse (argc, argv, MSG_NODELETED|MSG_SILENT, &list);
if (!rc)
{
n = list->msg_part[0];
msgset_free (list);
if (util_get_message (mbox, n, &msg))
return 1;
}
else
{
util_error (_("No applicable message"));
return 1;
}
}
cursor = n;
util_do_command ("print");
......