Fix more dereference before NULL checks

This commit is contained in:
twinaphex 2017-09-18 16:40:38 +02:00
parent fa7a792180
commit 770640be58
2 changed files with 9 additions and 7 deletions

View File

@ -117,16 +117,17 @@ static int action_left_input_desc(unsigned type, const char *label,
static int action_left_input_desc_kbd(unsigned type, const char *label,
bool wraparound)
{
settings_t *settings = config_get_ptr();
unsigned key_id;
unsigned offset = type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
unsigned remap_id =
settings->uints.input_keymapper_ids[offset];
char desc[PATH_MAX_LENGTH];
unsigned key_id;
unsigned remap_id;
unsigned offset = type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
settings_t *settings = config_get_ptr();
if (!settings)
return 0;
remap_id = settings->uints.input_keymapper_ids[offset];
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
{
if(remap_id == key_descriptors[key_id].key)

View File

@ -107,15 +107,16 @@ int action_right_input_desc_kbd(unsigned type, const char *label,
bool wraparound)
{
unsigned key_id;
unsigned remap_id;
char desc[PATH_MAX_LENGTH];
unsigned offset = type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
settings_t *settings = config_get_ptr();
unsigned remap_id =
settings->uints.input_keymapper_ids[offset];
if (!settings)
return 0;
remap_id = settings->uints.input_keymapper_ids[offset];
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
{
if(remap_id == key_descriptors[key_id].key)