mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 12:12:28 +00:00
Merge pull request #8098 from bojidar-bg/configfile-get-value-suppress
Suppress error messages when using ConfigFile::get_value and a default is given
This commit is contained in:
commit
ca3596b043
@ -82,8 +82,13 @@ void ConfigFile::set_value(const String &p_section, const String &p_key, const V
|
|||||||
}
|
}
|
||||||
Variant ConfigFile::get_value(const String &p_section, const String &p_key, Variant p_default) const {
|
Variant ConfigFile::get_value(const String &p_section, const String &p_key, Variant p_default) const {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(!values.has(p_section), p_default);
|
if (!values.has(p_section) || !values[p_section].has(p_key)) {
|
||||||
ERR_FAIL_COND_V(!values[p_section].has(p_key), p_default);
|
if (p_default.get_type() == Variant::NIL) {
|
||||||
|
ERR_EXPLAIN("Couldn't find the given section/key and no default was given");
|
||||||
|
ERR_FAIL_V(p_default);
|
||||||
|
}
|
||||||
|
return p_default;
|
||||||
|
}
|
||||||
return values[p_section][p_key];
|
return values[p_section][p_key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user