summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-06-24 13:30:17 +0100
committerCarl Hetherington <cth@carlh.net>2016-06-24 13:30:17 +0100
commitd848eed414a5d5c8bc35a3ec843f01e8b609f60d (patch)
tree53035603af7255e9edaed6458ba90640eb106765 /src
parente15231b81bfc9415c6aeece10be6a03642a26ca6 (diff)
Fix end-of-stringstream logic to not miss the last line.
Diffstat (limited to 'src')
-rw-r--r--src/util.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/util.cc b/src/util.cc
index a165126..66490c1 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -20,6 +20,7 @@
#include "util.h"
#include <string>
#include <sstream>
+#include <iostream>
#include <cstdio>
using std::string;
@@ -45,12 +46,12 @@ sub::empty_or_white_space (string s)
optional<string>
sub::get_line_stringstream (stringstream* str)
{
- string s;
- getline (*str, s);
if (!str->good ()) {
return optional<string> ();
}
+ string s;
+ getline (*str, s);
return s;
}