MDL-24445 fixed problem with uninitialised PAGE object
authorPetr Skoda <skodak@moodle.org>
Wed, 29 Sep 2010 21:09:19 +0000 (21:09 +0000)
committerPetr Skoda <skodak@moodle.org>
Wed, 29 Sep 2010 21:09:19 +0000 (21:09 +0000)
lib/weblib.php

index 63fb88e..0363501 100644 (file)
@@ -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);