diff --git a/course/enrol.php b/course/enrol.php index 1cc1f87e220..0ebb95e60aa 100644 --- a/course/enrol.php +++ b/course/enrol.php @@ -43,7 +43,7 @@ /// changed during this session or something if (has_capability('moodle/course:view', $context) and !has_capability('moodle/legacy:guest', $context, NULL, false)) { - if ($SESSION->wantsurl) { + if (!empty($SESSION->wantsurl)) { $destination = $SESSION->wantsurl; unset($SESSION->wantsurl); } else {