fix some segfaults caused by my menu_item->text changes

This commit is contained in:
Bill Currie 2002-08-27 08:11:10 +00:00
parent ec47e08e1c
commit f1938f6b36

View file

@ -563,8 +563,11 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down)
} else if (menu->items && menu->items[menu->cur_item]->func } else if (menu->items && menu->items[menu->cur_item]->func
&& menu->items[menu->cur_item]->allkeys) { && menu->items[menu->cur_item]->allkeys) {
item = menu->items[menu->cur_item]; item = menu->items[menu->cur_item];
G_INT (&menu_pr_state, OFS_PARM0) = if (item->text)
PR_SetString (&menu_pr_state, item->text); G_INT (&menu_pr_state, OFS_PARM0) =
PR_SetString (&menu_pr_state, item->text);
else
G_INT (&menu_pr_state, OFS_PARM0) = 0;
G_INT (&menu_pr_state, OFS_PARM1) = key; G_INT (&menu_pr_state, OFS_PARM1) = key;
PR_ExecuteProgram (&menu_pr_state, item->func); PR_ExecuteProgram (&menu_pr_state, item->func);
if (G_INT (&menu_pr_state, OFS_RETURN)) if (G_INT (&menu_pr_state, OFS_RETURN))
@ -588,8 +591,11 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down)
{ {
item = menu->items[menu->cur_item]; item = menu->items[menu->cur_item];
if (item->func) { if (item->func) {
G_INT (&menu_pr_state, OFS_PARM0) = if (item->text)
PR_SetString (&menu_pr_state, item->text); G_INT (&menu_pr_state, OFS_PARM0) =
PR_SetString (&menu_pr_state, item->text);
else
G_INT (&menu_pr_state, OFS_PARM0) = 0;
G_INT (&menu_pr_state, OFS_PARM1) = key; G_INT (&menu_pr_state, OFS_PARM1) = key;
PR_ExecuteProgram (&menu_pr_state, item->func); PR_ExecuteProgram (&menu_pr_state, item->func);
} else { } else {