diff --git a/lib/weblib.php b/lib/weblib.php index eaf6cbba0a3..e93b369e321 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2275,7 +2275,7 @@ function get_html_lang($dir = false) { global $CFG; $currentlang = current_language(); - if ($currentlang !== $CFG->lang && !get_string_manager()->translation_exists($currentlang)) { + if (isset($CFG->lang) && $currentlang !== $CFG->lang && !get_string_manager()->translation_exists($currentlang)) { // Use the default site language when the current language is not available. $currentlang = $CFG->lang; // Fix the current language.