Added check to make sure ident was not an empty string.

Added check to make sure ident was not an empty string.

This commit is to fix a bug related to having a autoconfig.cfg file without an ident.
Currently, there are none in the repository that fit this condition, which is why the bug was never triggered in testing. 

This checks to make sure the ident loaded from the config file actually has a value associated with it.
Without this check, the if() statement will always return true, because an empty string is always within another string.
This commit is contained in:
Christopher J. Gilbert 2015-04-21 23:06:21 -04:00
parent f1186ff01c
commit cf2623a65a

View File

@ -90,7 +90,7 @@ static bool input_try_autoconfigure_joypad_from_conf(config_file_t *conf,
}
/* Check for name match - name starts with ident */
if (!strncmp(params->name, ident, strlen(ident)))
if (ident[0] != '\0' && !strncmp(params->name, ident, strlen(ident)))
{
BIT32_SET(*match, AUTODETECT_MATCH_IDENT);
ret = true;