diff --git a/inc/targetchange.class.php b/inc/targetchange.class.php index 03082259b..5fee24d0d 100644 --- a/inc/targetchange.class.php +++ b/inc/targetchange.class.php @@ -216,6 +216,10 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con } /**@var PluginFormcreatorQuestion $question */ $question = $linker->getObject($input[$fieldSetting['field']], PluginFormcreatorQuestion::class); + if ($question === false) { + $typeName = strtolower(self::getTypeName()); + throw new ImportFailureException(sprintf(__('failed to add or update the %1$s %2$s: a question is missing and is used in a parameter of the target', 'formceator'), $typeName, $input['name'])); + } $input[$fieldSetting['field']] = $question->getID(); } diff --git a/inc/targetticket.class.php b/inc/targetticket.class.php index a6e61a5a0..ace1df7fe 100644 --- a/inc/targetticket.class.php +++ b/inc/targetticket.class.php @@ -1107,6 +1107,10 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con } /**@var PluginFormcreatorQuestion $question */ $question = $linker->getObject($input[$fieldSetting['field']], PluginFormcreatorQuestion::class); + if ($question === false) { + $typeName = strtolower(self::getTypeName()); + throw new ImportFailureException(sprintf(__('failed to add or update the %1$s %2$s: a question is missing and is used in a parameter of the target', 'formceator'), $typeName, $input['name'])); + } $input[$fieldSetting['field']] = $question->getID(); }