Skip to content
Snippets Groups Projects
Commit 289fcb48 authored by Justus Dieckmann's avatar Justus Dieckmann Committed by Tobias Reischmann
Browse files

Prevent non-object error for workflow without any steps

parent be223a7e
No related branches found
No related tags found
No related merge requests found
...@@ -102,18 +102,23 @@ class processor { ...@@ -102,18 +102,23 @@ class processor {
$workflow = workflow_manager::get_workflow($process->workflowid); $workflow = workflow_manager::get_workflow($process->workflowid);
while (true) { while (true) {
if ($process->stepindex == 0) {
process_manager::proceed_process($process);
}
$step = step_manager::get_step_instance_by_workflow_index($process->workflowid, $process->stepindex);
$lib = lib_manager::get_step_lib($step->subpluginname);
try { try {
$course = get_course($process->courseid); $course = get_course($process->courseid);
} catch (\dml_missing_record_exception $e) { } catch (\dml_missing_record_exception $e) {
// Course no longer exists! // Course no longer exists!
break; break;
} }
if ($process->stepindex == 0) {
if (!process_manager::proceed_process($process)) {
// Happens for a workflow with no step.
delayed_courses_manager::set_course_delayed_for_workflow($course->id, false, $workflow);
break;
}
}
$step = step_manager::get_step_instance_by_workflow_index($process->workflowid, $process->stepindex);
$lib = lib_manager::get_step_lib($step->subpluginname);
if ($process->waiting) { if ($process->waiting) {
$result = $lib->process_waiting_course($process->id, $step->id, $course); $result = $lib->process_waiting_course($process->id, $step->id, $course);
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment