Skip to content

Commit

Permalink
Issue Syxton#84 Throw exception for the empty new cmid
Browse files Browse the repository at this point in the history
  • Loading branch information
TomoTsuyuki committed Nov 21, 2023
1 parent bfe404e commit 91ba703
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions classes/massactionutils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 91ba703

Please sign in to comment.