Bytecode: exit gracefully when M_ does not exist

trustregion
Sébastien Villemot 2022-02-09 14:32:25 +01:00
parent bb793d87cc
commit 0caefa1593
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright © 2007-2021 Dynare Team * Copyright © 2007-2022 Dynare Team
* *
* This file is part of Dynare. * This file is part of Dynare.
* *
@ -203,6 +203,8 @@ public:
ErrorMsg() ErrorMsg()
{ {
mxArray *M_ = mexGetVariable("global", "M_"); mxArray *M_ = mexGetVariable("global", "M_");
if (!M_)
mexErrMsgTxt("Can't find global variable M_");
if (mxGetFieldNumber(M_, "endo_names") == -1) if (mxGetFieldNumber(M_, "endo_names") == -1)
{ {
nb_endo = 0; nb_endo = 0;