From 380e78be532b7814ee485ae8c5e75717a0b90fd4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 18 Dec 2023 15:05:15 +0100
Subject: [PATCH] user_has_matlab_license: fix spurious messages when toolbox
 is not present

This is effectively a partial revert of
735bd66d4dea2f244918687fa0fa57051df59673.
---
 matlab/user_has_matlab_license.m | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/matlab/user_has_matlab_license.m b/matlab/user_has_matlab_license.m
index 354b03344a..5f7105e873 100644
--- a/matlab/user_has_matlab_license.m
+++ b/matlab/user_has_matlab_license.m
@@ -11,7 +11,7 @@ function [hasLicense] = user_has_matlab_license(toolbox)
 % SPECIAL REQUIREMENTS
 %   none
 
-% Copyright © 2012-2020 Dynare Team
+% Copyright © 2012-2023 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -28,7 +28,9 @@ function [hasLicense] = user_has_matlab_license(toolbox)
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
 
-hasLicense = license('checkout',toolbox);
+% NB: the second output argument should not be removed, otherwise MATLAB will
+% display an error message if the toolbox is not present.
+[hasLicense, ~] = license('checkout',toolbox);
 
 if ~hasLicense
     return
-- 
GitLab