From 75d90d5963970a21ec3165d6028922e31127f8a4 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sun, 23 Nov 2014 19:13:42 +0100 Subject: [PATCH] Fix a crash in the "repl" command refs #7805 --- lib/cli/replcommand.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/cli/replcommand.cpp b/lib/cli/replcommand.cpp index 29e3c7074..e22679c99 100644 --- a/lib/cli/replcommand.cpp +++ b/lib/cli/replcommand.cpp @@ -73,11 +73,16 @@ int ReplCommand::Run(const po::variables_map& vm, const std::vector expr = ConfigCompiler::CompileText("", line); + bool has_errors = false; + BOOST_FOREACH(const ConfigCompilerMessage& message, ConfigCompilerContext::GetInstance()->GetMessages()) { + if (message.Error) + has_errors = true; + std::cout << (message.Error ? "Error" : "Warning") << ": " << message.Text << "\n"; } - if (expr) { + if (expr && !has_errors) { Value result = expr->Evaluate(frame); std::cout << ConsoleColorTag(Console_ForegroundCyan); if (!result.IsObject() || result.IsObjectType() || result.IsObjectType())