Permalink
Browse files

MDL-25981 make sure cm is defined

  • Loading branch information...
skodak committed Jan 31, 2011
1 parent 0d8b6a6 commit d4fb0e26e21d502046a57c68e6c5931d139d8839
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/moodlelib.php
View
@@ -2654,7 +2654,7 @@ function require_course_login($courseorid, $autologinguest = true, $cm = NULL, $
global $CFG, $PAGE, $SITE;
$issite = (is_object($courseorid) and $courseorid->id == SITEID)
or (!is_object($courseorid) and $courseorid == SITEID);
- if ($issite && !($cm instanceof cm_info)) {
+ if ($issite && !empty($cm) && !($cm instanceof cm_info)) {
// note: nearly all pages call get_fast_modinfo anyway and it does not make any
// db queries so this is not really a performance concern, however it is obviously
// better if you use get_fast_modinfo to get the cm before calling this.

0 comments on commit d4fb0e2

Please sign in to comment.