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;