Skip to content

Commit daf05d5

Browse files
fix error when otherindex does not exist
1 parent ddb70d8 commit daf05d5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

classes/local/manager/workflow_manager.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,14 @@ public static function change_sortindex($workflowid, $up) {
328328
array(
329329
'sortindex' => $otherindex)
330330
);
331-
$otherworkflow = workflow::from_record($otherrecord);
331+
if (false !== $otherrecord) {
332+
$otherworkflow = workflow::from_record($otherrecord);
333+
$otherworkflow->sortindex = $index;
334+
self::insert_or_update($otherworkflow);
335+
}
332336

333337
$workflow->sortindex = $otherindex;
334-
$otherworkflow->sortindex = $index;
335338
self::insert_or_update($workflow);
336-
self::insert_or_update($otherworkflow);
337339

338340
$transaction->allow_commit();
339341
}

0 commit comments

Comments
 (0)