From 11241b907715c1bd4405e09a5d2be2f5b37ca55a Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Mon, 18 Jun 2012 11:35:12 -0700 Subject: [PATCH] Make config file parsing more forgiving of all whitespace lines. --- src/ParseSection.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ParseSection.cpp b/src/ParseSection.cpp index e0fe2425db..1f95662135 100644 --- a/src/ParseSection.cpp +++ b/src/ParseSection.cpp @@ -1,4 +1,5 @@ #include "ParseSection.h" +#include "utils.h" #include #include @@ -32,6 +33,8 @@ section ParseSection(const std::string& strInput, const bool bTrim) if (strValue.empty() || strValue[0] == '#') { // Blank line or comment, do nothing. + + nothing(); } else if (strValue[0] == '[' && strValue[strValue.length()-1] == ']') { // New section. @@ -41,11 +44,12 @@ section ParseSection(const std::string& strInput, const bool bTrim) } else { - // Another line in a section. + // Another line for section. if (bTrim) boost::algorithm::trim(strValue); - secResult[strSection].push_back(strValue); + if (!strValue.empty()) + secResult[strSection].push_back(strValue); } }