diff options
author | Treeston <treeston.mmoc@gmail.com> | 2020-08-24 16:17:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-24 16:17:56 +0200 |
commit | 11c4a60fbe9d471618e0579f588706746ff3e439 (patch) | |
tree | f34844cbc943b9e6aa1c9d78a1da318893dc8101 /src/common/Configuration/Config.cpp | |
parent | ec783fcbb59fcd6e657bc1a39c2b073fd7506ed4 (diff) |
[3.3.5] Core/ChatCommands: C++17 cleanup (if constexpr + std::string_view)
Diffstat (limited to 'src/common/Configuration/Config.cpp')
-rw-r--r-- | src/common/Configuration/Config.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/common/Configuration/Config.cpp b/src/common/Configuration/Config.cpp index fa0e546ccc3..d9af7ae1187 100644 --- a/src/common/Configuration/Config.cpp +++ b/src/common/Configuration/Config.cpp @@ -137,7 +137,15 @@ bool ConfigMgr::GetBoolDefault(std::string const& name, bool def, bool quiet) co { std::string val = GetValueDefault(name, std::string(def ? "1" : "0"), quiet); val.erase(std::remove(val.begin(), val.end(), '"'), val.end()); - return StringToBool(val); + Optional<bool> boolVal = StringToBool(val); + if (boolVal) + return *boolVal; + else + { + TC_LOG_ERROR("server.loading", "Bad value defined for name %s in config file %s, going to use '%s' instead", + name.c_str(), _filename.c_str(), def ? "true" : "false"); + return def; + } } int ConfigMgr::GetIntDefault(std::string const& name, int def, bool quiet) const |