From 118838fb79c774464b058c319104919b27b06632 Mon Sep 17 00:00:00 2001 From: ChrissiQ Date: Thu, 31 May 2018 11:56:51 -0600 Subject: [PATCH] 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. --- src/Forms/GridFieldSortableRows.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Forms/GridFieldSortableRows.php b/src/Forms/GridFieldSortableRows.php index 0570a3d..fca0b22 100644 --- a/src/Forms/GridFieldSortableRows.php +++ b/src/Forms/GridFieldSortableRows.php @@ -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; }