Skip to content

Commit

Permalink
MDL-61970 mod_survey: Do not assume context passed is one of survey
Browse files Browse the repository at this point in the history
  • Loading branch information
FMCorz committed Apr 19, 2018
1 parent 61ae0c2 commit b82e600
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mod/survey/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ public static function delete_data_for_user(approved_contextlist $contextlist) {
* @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.
Expand Down

0 comments on commit b82e600

Please sign in to comment.