summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-03-12 21:15:51 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-03-12 21:24:19 +0100
commit2b711a3f1358404472cd272c3d20bdbabea31d4e (patch)
tree8f2ffa20fc51a6ebbbb20bbda925ae55341fd45f /src
parent0e2a9c41c5b14f3037c8df8e6deddba63fa7120e (diff)
downloadmanaserv-2b711a3f1358404472cd272c3d20bdbabea31d4e.tar.gz
manaserv-2b711a3f1358404472cd272c3d20bdbabea31d4e.tar.bz2
manaserv-2b711a3f1358404472cd272c3d20bdbabea31d4e.tar.xz
manaserv-2b711a3f1358404472cd272c3d20bdbabea31d4e.zip
Allow values to be set to empty in the configuration
No reason why these should be ignored and then replaced by their defaults, generally. Reviewed-by: Jared Adams
Diffstat (limited to 'src')
-rw-r--r--src/common/configuration.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/common/configuration.cpp b/src/common/configuration.cpp
index 6b79b85e..9d0e81ee 100644
--- a/src/common/configuration.cpp
+++ b/src/common/configuration.cpp
@@ -55,16 +55,16 @@ bool Configuration::initialize(const std::string &filename)
for (node = node->xmlChildrenNode; node != NULL; node = node->next)
{
- if (xmlStrEqual(node->name, BAD_CAST "option"))
- {
- std::string key = XML::getProperty(node, "name", "");
- std::string value = XML::getProperty(node, "value", "");
-
- if (!key.empty() && !value.empty())
- {
- options[key] = value;
- }
- }
+ if (!xmlStrEqual(node->name, BAD_CAST "option"))
+ continue;
+ if (!XML::hasProperty(node, "name") || !XML::hasProperty(node, "value"))
+ continue;
+
+ std::string key = XML::getProperty(node, "name", std::string());
+ std::string value = XML::getProperty(node, "value", std::string());
+
+ if (!key.empty())
+ options[key] = value;
}
xmlFreeDoc(doc);