From 0f23fec85deb264afa0c1dd473822ba9160e4001 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Sun, 20 Aug 2023 18:12:13 +0200 Subject: [PATCH] shell: fix double syntax errors aborting program Type e.g. "e 1 + 2 * 3". The first "+" throws a syntax error (parentheses are needed around expressions) and the "*" another one during the final exhaust_until_separator phase, which wasn't protected by a try/catch. --- shell/main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/shell/main.cpp b/shell/main.cpp index 249f1b6..07821f7 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -424,7 +424,15 @@ int main(int argc, char **argv) } /* Exhaust command input (if not all used by the command) */ - parser.exhaust_until_separator(); + while(true) { + try { + parser.exhaust_until_separator(); + break; + } + catch(std::exception &e) { + FxOS_log(ERR, "%s", e.what()); + } + } } /* Save command history */