Add checks for null pointer / failed malloc to menu code

This commit is contained in:
mmdolze
2009-06-06 14:48:48 +00:00
parent 490e5f212c
commit 8644e5a347
5 changed files with 120 additions and 38 deletions
+12
View File
@@ -336,6 +336,18 @@ MenuItem *menu_find_item(Menu *menu, char *id, bool recursive)
void menu_set_association(Menu *menu, void *assoc)
{
/*
* assoc can currently be either a Screen or Driver, but there's
* no way to tell, so just display (data) if it's not NULL
*/
debug(RPT_DEBUG, "%s(menu=[%s], assoc=[%s])", __FUNCTION__,
((menu != NULL) ? menu->id : "(null)"),
((assoc != NULL) ? "(data)" : "(null)"));
/* note that assoc is allowed to be NULL */
if (menu == NULL)
return;
menu->data.menu.association = assoc;
}