diff --git a/lib/classes/task/manager.php b/lib/classes/task/manager.php index e623fa3609a..fc5369a5c59 100644 --- a/lib/classes/task/manager.php +++ b/lib/classes/task/manager.php @@ -650,15 +650,17 @@ class manager { foreach ($records as $record) { $task = self::scheduled_task_from_record($record); + // Safety check in case the task in the DB does not match a real class (maybe something was uninstalled). + if (!$task) { + continue; + } + // Tasks belonging to deprecated plugin types are excluded. if (self::task_component_is_deprecated($task)) { continue; } - // Safety check in case the task in the DB does not match a real class (maybe something was uninstalled). - if ($task) { - $tasks[] = $task; - } + $tasks[] = $task; } return $tasks;