Skip to content

Commit e1b1f60

Browse files
committed
[ CID 14903 ] Fix unchecked return value issue.
1 parent 07def4a commit e1b1f60

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

engine/src/exec-dialog.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,22 @@ void MCDialogExecAnswerNotify(MCExecContext &ctxt, integer_t p_type, MCStringRef
352352
MCAutoListRef t_button_list;
353353
MCAutoStringRef t_buttons_string;
354354

355-
/* UNCHECKED */ MCListCreateMutable('\n', &t_button_list);
356-
for (uindex_t i = 0; i < p_button_count; i++)
357-
/* UNCHECKED */ MCListAppend(*t_button_list, p_buttons[i]);
358-
/* UNCHECKED */ MCListCopyAsString(*t_button_list, &t_buttons_string);
355+
bool t_success;
356+
t_success = true;
357+
358+
if (t_success)
359+
t_success = MCListCreateMutable('\n', &t_button_list);
360+
for (uindex_t i = 0; t_success && i < p_button_count; i++)
361+
t_success = MCListAppend(*t_button_list, p_buttons[i]);
362+
if (t_success)
363+
t_success = MCListCopyAsString(*t_button_list, &t_buttons_string);
359364

365+
if (!t_success)
366+
{
367+
ctxt.Throw();
368+
return;
369+
}
370+
360371
MCStringRef t_args[4];
361372
t_args[0] = p_title;
362373
t_args[1] = p_prompt;

0 commit comments

Comments
 (0)