From f1938f6b368c094eb265e2d9e15abdce8b0bedba Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 27 Aug 2002 08:11:10 +0000 Subject: [PATCH] fix some segfaults caused by my menu_item->text changes --- libs/console/menu.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libs/console/menu.c b/libs/console/menu.c index 4fe04ae28..dc08dbc5f 100644 --- a/libs/console/menu.c +++ b/libs/console/menu.c @@ -563,8 +563,11 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down) } else if (menu->items && menu->items[menu->cur_item]->func && menu->items[menu->cur_item]->allkeys) { item = menu->items[menu->cur_item]; - G_INT (&menu_pr_state, OFS_PARM0) = - PR_SetString (&menu_pr_state, item->text); + if (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; PR_ExecuteProgram (&menu_pr_state, item->func); 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]; if (item->func) { - G_INT (&menu_pr_state, OFS_PARM0) = - PR_SetString (&menu_pr_state, item->text); + if (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; PR_ExecuteProgram (&menu_pr_state, item->func); } else {