Fixes "undefined offset" error when moving a many_many item to previous page (#121)

When viewing the last page of a list of data objects, trying to move one of them to the previous page triggers an "undefined offset" error.
This commit is contained in:
ChrissiQ 2018-05-31 11:56:51 -06:00 committed by Ed Chipman
parent 5e3e5cac3f
commit 118838fb79

View File

@ -656,7 +656,7 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP
$i = 1;
foreach ($items as $obj) {
if ($obj->ID == $targetItem->ID) {
if ($obj->ID == $targetItem->ID || $i >= count($sortPositions)) {
continue;
}