>From de2948bfd3fcab8d8e825c40eb0cbb2fbd2cf278 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 27 Aug 2015 19:20:46 +0200 Subject: [PATCH] Fix bug in split_in_lines() which lost the last line entirely. Manual code which replaced the use of boost::split() was buggy and simply lost the contents of the last line. --- wx_table_generator.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp index baec6f9..73161d0 100644 --- a/wx_table_generator.cpp +++ b/wx_table_generator.cpp @@ -57,11 +57,15 @@ std::vector split_in_lines(std::string const& s) // here. std::vector lines; std::string line; - for(std::string::const_iterator i = s.begin(); i != s.end(); ++i) + for(std::string::const_iterator i = s.begin(); ; ++i) { - if('\n' == *i) + if(i == s.end() || '\n' == *i) { lines.push_back(line); + if(i == s.end()) + { + break; + } line.clear(); } else -- 2.1.0