diff --git a/src/load_map.cpp b/src/load_map.cpp index 3e2cdf3ec..6fc3f1af0 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -136,19 +136,23 @@ void remove_empty_text_nodes(ptree &pt) { ptree::iterator itr = pt.begin(); ptree::iterator end = pt.end(); - for (;itr!=end; itr++) + while (itr!=end) { if (itr->first == "") { std::string trimmed = boost::algorithm::trim_copy(itr->second.data()); if (trimmed.empty()) { itr = pt.erase(itr); + } else { + itr++; } } else { remove_empty_text_nodes(itr->second); + itr++; } } } +//#include void load_map(Map & map, std::string const& filename, bool strict) { ptree pt;