aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/main/main.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/main/main.cpp b/examples/main/main.cpp
index 9af8a74..e9478d5 100644
--- a/examples/main/main.cpp
+++ b/examples/main/main.cpp
@@ -450,7 +450,10 @@ int main(int argc, char ** argv) {
std::string line;
bool another_line = true;
do {
- std::getline(std::cin, line);
+ if (!std::getline(std::cin, line)) {
+ // input stream is bad or EOF received
+ return 0;
+ }
if (line.empty() || line.back() != '\\') {
another_line = false;
} else {