diff options
| author | 2024-11-01 14:35:23 +0000 | |
|---|---|---|
| committer | 2024-11-01 15:53:04 +0000 | |
| commit | 8a3aba4044ee10df332631c4c66ed60299566e58 (patch) | |
| tree | afb185a313dff83d61c26e3b95f47b62d3ab5694 /src/configparser.cpp | |
| parent | Default <options:extbanformat> to name. (diff) | |
| parent | Use fmtlib instead of iostream in ConvToStr where available. (diff) | |
Merge branch 'insp4' into master.
Diffstat (limited to 'src/configparser.cpp')
| -rw-r--r-- | src/configparser.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp index 3350290e6..f32165df9 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -732,12 +732,15 @@ bool ConfigTag::getBool(const std::string& key, bool def) const return def; } -unsigned char ConfigTag::getCharacter(const std::string& key, unsigned char def) const +unsigned char ConfigTag::getCharacter(const std::string& key, unsigned char def, bool emptynul) const { std::string result; - if (!readString(key, result) || result.size() != 1) + if (!readString(key, result)) return def; + if (result.size() != 1) + return result.empty() && emptynul ? 0 : def; + return result[0]; } |
