From 4b8290faa59b0928e8355d53d15b2188f13f30be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Wed, 18 Nov 2020 17:47:37 +0100 Subject: [PATCH] =?UTF-8?q?Do=20not=20crash=20when=20unknown=20symbol=20is?= =?UTF-8?q?=20passed=20to=20=E2=80=9Cirf=5Fshocks=E2=80=9D=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: #57 --- src/ParsingDriver.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc index 0ced2a61..3fa0e780 100644 --- a/src/ParsingDriver.cc +++ b/src/ParsingDriver.cc @@ -1414,8 +1414,12 @@ ParsingDriver::option_symbol_list(string name_option) { vector shocks = symbol_list.get_symbols(); for (auto &shock : shocks) - if (mod_file->symbol_table.getType(shock) != SymbolType::exogenous) - error("Variables passed to irf_shocks must be exogenous. Caused by: " + shock); + { + if (!mod_file->symbol_table.exists(shock)) + error("Unknown symbol: " + shock); + if (mod_file->symbol_table.getType(shock) != SymbolType::exogenous) + error("Variables passed to irf_shocks must be exogenous. Caused by: " + shock); + } } if (name_option.compare("ms.parameters") == 0)