MDL-61970 mod_survey: Do not assume context passed is one of survey

This commit is contained in:
Frédéric Massart
2018-04-19 13:10:22 +08:00
parent 61ae0c28db
commit b82e600723
+2 -2
View File
@@ -281,8 +281,8 @@ class provider implements
* @return int
*/
protected static function get_survey_id_from_context(context_module $context) {
$cm = get_coursemodule_from_id('survey', $context->instanceid, 0, false, MUST_EXIST);
return (int) $cm->instance;
$cm = get_coursemodule_from_id('survey', $context->instanceid);
return $cm ? (int) $cm->instance : 0;
}
/**
* Loop and export from a recordset.