diff --git a/classes/massactionutils.php b/classes/massactionutils.php index b4b0dde..d3f87b1 100644 --- a/classes/massactionutils.php +++ b/classes/massactionutils.php @@ -159,6 +159,9 @@ public static function duplicate_cm_to_course(object $course, object $cm): int { } } } + if (empty($newcmid)) { + throw new \moodle_exception('Could not duplicate course module from id ' . $cm->id); + } return $newcmid; } }