From 98ae29ae24e717dc22a7c4fbc2f737aca969188e Mon Sep 17 00:00:00 2001 From: Farhan Karmali Date: Mon, 24 Feb 2020 13:47:14 +0530 Subject: [PATCH] MDL-67024 Lib: Check if user->mnethostid is set before using it --- lib/pagelib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pagelib.php b/lib/pagelib.php index 1447623977d..7e173071f40 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -1609,7 +1609,8 @@ class moodle_page { } $mnetpeertheme = ''; - if (isloggedin() and isset($CFG->mnet_localhost_id) and $USER->mnethostid != $CFG->mnet_localhost_id) { + $mnetvarsok = isset($CFG->mnet_localhost_id) && isset($USER->mnethostid); + if (isloggedin() and $mnetvarsok and $USER->mnethostid != $CFG->mnet_localhost_id) { require_once($CFG->dirroot.'/mnet/peer.php'); $mnetpeer = new mnet_peer(); $mnetpeer->set_id($USER->mnethostid);