aboutsummaryrefslogtreecommitdiffstats
path: root/src/configparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/configparser.cpp')
-rw-r--r--src/configparser.cpp7
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];
}