X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=blobdiff_plain;f=lib%2Fweblib.php;h=0363501f9a9f6b1f14de5355ca4b7260d85dc157;hp=63fb88e5614a898fcdddcb98079320076a9335c0;hb=9b540305dfa3eefe04583efd8c40703cd989e496;hpb=e38442715beeaaef8948655a3f4249318c23c1f5 diff --git a/lib/weblib.php b/lib/weblib.php index 63fb88e5614..0363501f9a9 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2519,7 +2519,9 @@ function redirect($url, $message='', $delay=-1) { } // prevent debug errors - make sure context is properly initialised - $PAGE->set_context(null); + if ($PAGE) { + $PAGE->set_context(null); + } if ($url instanceof moodle_url) { $url = $url->out(false);