From 0caefa15939ffc7bce9b8dca356aec5d8398dbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Wed, 9 Feb 2022 14:32:25 +0100 Subject: [PATCH] Bytecode: exit gracefully when M_ does not exist --- mex/sources/bytecode/ErrorHandling.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mex/sources/bytecode/ErrorHandling.hh b/mex/sources/bytecode/ErrorHandling.hh index b02bc19e1..ee5eb8de0 100644 --- a/mex/sources/bytecode/ErrorHandling.hh +++ b/mex/sources/bytecode/ErrorHandling.hh @@ -1,5 +1,5 @@ /* - * Copyright © 2007-2021 Dynare Team + * Copyright © 2007-2022 Dynare Team * * This file is part of Dynare. * @@ -203,6 +203,8 @@ public: ErrorMsg() { mxArray *M_ = mexGetVariable("global", "M_"); + if (!M_) + mexErrMsgTxt("Can't find global variable M_"); if (mxGetFieldNumber(M_, "endo_names") == -1) { nb_endo = 0;