From 4a1dbc5ca4099f6e693aff06052ad3b103a946e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Wed, 3 Feb 2021 19:51:56 +0100 Subject: [PATCH] Bytecode: fix bug introduced in previous commit map::at() does bound checking, and throws an exception if out-of-range, contrary to [] operator which returns a new element. --- mex/sources/bytecode/Interpreter.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mex/sources/bytecode/Interpreter.cc b/mex/sources/bytecode/Interpreter.cc index 5645c3d74..88a8cb0a2 100644 --- a/mex/sources/bytecode/Interpreter.cc +++ b/mex/sources/bytecode/Interpreter.cc @@ -870,8 +870,8 @@ Interpreter::extended_path(const string &file_name, const string &bin_basename, it_code = Init_Code; vector_table_conditional_local.clear(); - if (table_conditional_global.size()) - vector_table_conditional_local = table_conditional_global.at(t); + if (auto it = table_conditional_global.find(t); it != table_conditional_global.end()) + vector_table_conditional_local = it->second; if (t < nb_periods) MainLoop(bin_basename, code, evaluate, block, false, true, sconstrained_extended_path, vector_table_conditional_local); else