Fix a crash in the "repl" command

refs #7805
This commit is contained in:
Gunnar Beutner 2014-11-23 19:13:42 +01:00
parent d366dd8e30
commit 75d90d5963
1 changed files with 6 additions and 1 deletions

View File

@ -73,11 +73,16 @@ int ReplCommand::Run(const po::variables_map& vm, const std::vector<std::string>
expr = ConfigCompiler::CompileText("<console>", 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<Array>() || result.IsObjectType<Dictionary>())