From 2b711a3f1358404472cd272c3d20bdbabea31d4e Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 12 Mar 2011 21:15:51 +0100 Subject: 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 --- src/common/configuration.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/common/configuration.cpp') 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); -- cgit v1.2.3-70-g09d2