More static analyzer warning fixes

This commit is contained in:
twinaphex 2018-03-29 14:19:24 +02:00
parent 2c882a01c1
commit 3fe6ecbce7
2 changed files with 8 additions and 8 deletions

View File

@ -136,11 +136,9 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
file_list_get_actiondata_at_offset(selection_buf, selection)
: NULL;
if (cbs->enum_idx != MSG_UNKNOWN)
{
if (cbs && cbs->enum_idx != MSG_UNKNOWN)
ret = menu_hash_get_help_enum(cbs->enum_idx,
menu->menu_state_msg, sizeof(menu->menu_state_msg));
}
else
{
unsigned type = 0;

View File

@ -327,10 +327,14 @@ static bool task_overlay_resolve_targets(struct overlay *ol,
unsigned i;
struct overlay *current = (struct overlay*)&ol[idx];
if (!current)
return false;
for (i = 0; i < current->size; i++)
{
ssize_t next_idx = 0;
const char *next = current->descs[i].next_index_name;
struct overlay_desc *desc = (struct overlay_desc*)&current->descs[i];
const char *next = desc ? desc->next_index_name : NULL;
ssize_t next_idx = (idx + 1) & size;
if (!string_is_empty(next))
{
@ -343,10 +347,8 @@ static bool task_overlay_resolve_targets(struct overlay *ol,
return false;
}
}
else
next_idx = (idx + 1) & size;
current->descs[i].next_index = (unsigned)next_idx;
desc->next_index = (unsigned)next_idx;
}
return true;