diff --git a/course/format/singleactivity/lib.php b/course/format/singleactivity/lib.php index 6556c127e50..5db9dea89ea 100644 --- a/course/format/singleactivity/lib.php +++ b/course/format/singleactivity/lib.php @@ -181,7 +181,7 @@ class format_singleactivity extends format_base { ), ); - if (!isset($availabletypes[$config->activitytype])) { + if (!empty($availabletypes) && !isset($availabletypes[$config->activitytype])) { $courseformatoptions['activitytype']['default'] = array_keys($availabletypes)[0]; } }