diff --git a/lib.php b/lib.php index 679e3ae..779936f 100644 --- a/lib.php +++ b/lib.php @@ -60,17 +60,19 @@ function mod_exp360_cm_info_dynamic(cm_info $cm) // Get the value of _url property, which is a moodle_url object $urlObject = $urlProperty->getValue($PAGE); - // Now access the path property within the moodle_url object - $urlReflection = new ReflectionClass($urlObject); - $pathProperty = $urlReflection->getProperty('path'); - $pathProperty->setAccessible(true); + if ($urlObject) { + // Now access the path property within the moodle_url object + $urlReflection = new ReflectionClass($urlObject); + $pathProperty = $urlReflection->getProperty('path'); + $pathProperty->setAccessible(true); - // Get the value of the path property - $pathValue = $pathProperty->getValue($urlObject); + // Get the value of the path property + $pathValue = $pathProperty->getValue($urlObject); - // All of this only to bypass a little bug - if ($pathValue == '/course/modedit.php') { - return; + // All of this only to bypass a little bug + if ($pathValue == '/course/modedit.php') { + return; + } } }