rgui_entry_iterate - some more safety checks

This commit is contained in:
twinaphex 2015-02-01 10:23:40 +01:00
parent 5b2c2343c0
commit 7521b9fcda

View File

@ -46,6 +46,10 @@ typedef struct rgui_handle
static int rgui_entry_iterate(unsigned action)
{
const char *label = NULL;
if (!driver.menu || !driver.menu->menu_list)
return -1;
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
menu_list_get_actiondata_at_offset(driver.menu->menu_list->selection_buf,
driver.menu->selection_ptr);
@ -55,10 +59,12 @@ static int rgui_entry_iterate(unsigned action)
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
driver.menu_ctx->set_texture(driver.menu);
if (cbs && cbs->action_iterate)
return cbs->action_iterate(label, action);
return -1;
if (!cbs)
return -1;
if (!cbs->action_iterate)
return -1;
return cbs->action_iterate(label, action);
}
static void rgui_copy_glyph(uint8_t *glyph, const uint8_t *buf)