diff options
| author | 2024-10-16 11:39:59 +0100 | |
|---|---|---|
| committer | 2024-10-16 11:39:59 +0100 | |
| commit | a9a6411051e2c39ff17c3bf6e7b46c658505da4f (patch) | |
| tree | b7fa6f43d79101d9b8c0058e0b1c1d58a994c499 /src/configparser.cpp | |
| parent | Also match account bans against grouped nicknames. (diff) | |
Allow ConfigTag::getCharacter to return NUL for an empty field.
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 8cdd1f7f5..457840b71 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]; } |
