Do not crash when unknown symbol is passed to “irf_shocks” option

Closes: #57
issue#70
Sébastien Villemot 2020-11-18 17:47:37 +01:00
parent b1df9ecc38
commit 4b8290faa5
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 6 additions and 2 deletions

View File

@ -1414,8 +1414,12 @@ ParsingDriver::option_symbol_list(string name_option)
{
vector<string> 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)