From fb5bbd7700afc1b8a6bea196bb92c39308690799 Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 29 Sep 2023 12:43:04 -0400 Subject: [PATCH] [media] fixes issue when media module try to instantiate a non existing instrument. --- .../media/php/mediafileprovisioner.class.inc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/media/php/mediafileprovisioner.class.inc b/modules/media/php/mediafileprovisioner.class.inc index 0f30249bba0..158a0070d61 100644 --- a/modules/media/php/mediafileprovisioner.class.inc +++ b/modules/media/php/mediafileprovisioner.class.inc @@ -91,10 +91,19 @@ class MediaFileProvisioner extends \LORIS\Data\Provisioners\DBRowProvisioner // make sure not to call the factory when $testname is null or '' if (!empty($testname) && !isset($this->_instrumentnames[$testname])) { - $this->_instrumentnames[$testname] = \NDB_BVL_Instrument::factory( - $this->lorisinstance, - $testname, - )->getFullname(); + try { + $this->_instrumentnames[$testname] = \NDB_BVL_Instrument::factory( + $this->lorisinstance, + $testname, + )->getFullname(); + } catch (\Exception $e) { + error_log( + "There was a problem instantiating the instrument ". + "'$testname'. Make sure the instrument is valid and ". + "functional in order for it to be displayed in the media ". + "module." + ); + } } $row['fullName'] = $this->_instrumentnames[$testname] ?? null;