Invalid boolean values should fall back to the default
Previously, an invalid value was always false
This commit is contained in:
parent
a2e0a6efe7
commit
187d3f9ab9
@ -175,7 +175,7 @@ int ini_get_bool(char *section, char *key, int def)
|
||||
case '0':
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
return def;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ TEST test_ini_get_bool(void)
|
||||
ASSERT(ini_get_bool(bool_section, "boolbin1", false));
|
||||
ASSERT_FALSE(ini_get_bool(bool_section, "boolbin0", true));
|
||||
|
||||
ASSERT(ini_get_bool(bool_section, "boolinvalid", true));
|
||||
ASSERT_FALSE(ini_get_bool(bool_section, "boolinvalid", false));
|
||||
|
||||
ASSERT(ini_get_bool(bool_section, "nonexistent", true));
|
||||
|
Loading…
x
Reference in New Issue
Block a user