[common] option: fix crash on failure to parse invalid config file

This commit is contained in:
Geoffrey McRae 2019-05-21 12:28:13 +10:00
parent 7cc0f7cb99
commit ce9b94e93d
2 changed files with 8 additions and 1 deletions

View File

@ -1 +1 @@
a12-194-g06c229dfd4+1 a12-195-g7cc0f7cb99+1

View File

@ -415,6 +415,13 @@ bool option_load(const char * filename)
case '\n': case '\n':
if (name) if (name)
{ {
if (!module)
{
DEBUG_ERROR("Syntax error on line %d, module not specified for option", lineno);
result = false;
goto exit;
}
struct Option * o = option_get(module, name); struct Option * o = option_get(module, name);
if (!o) if (!o)
DEBUG_WARN("Ignored unknown option %s:%s", module, name); DEBUG_WARN("Ignored unknown option %s:%s", module, name);