From 57c28b24267f822e9c3e759e2f2ec4387221c9d3 Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 26 Sep 2021 17:33:46 +0200 Subject: [PATCH] CLI: startInteractive(): Handle bad()/eof() --- cli.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cli.cpp b/cli.cpp index 7d6127e..9c32e82 100644 --- a/cli.cpp +++ b/cli.cpp @@ -205,6 +205,16 @@ void CLI::startInteractive() std::cout << "> "; std::getline(std::cin, input); + if(std::cin.bad() || std::cin.eof()) + { + std::cout << "Exiting" << std::endl; + return; + } + if(input.empty()) + { + continue; + } + std::vector splitted = utils::split(input, "\\s+"); if(splitted.empty()) {