From 685f3242a2a53083a065733d5082f7f12c87b577 Mon Sep 17 00:00:00 2001 From: Zauberfisch Date: Tue, 30 Oct 2018 06:25:25 +0000 Subject: [PATCH] FIX: SortedDataList should never contain non-existing objects or null --- src/SortedDataList.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SortedDataList.php b/src/SortedDataList.php index 2a11a24..7dc0746 100644 --- a/src/SortedDataList.php +++ b/src/SortedDataList.php @@ -9,7 +9,10 @@ protected function deserializeItems(array $items) { foreach ($items as $item) { $className = $item[0]; $id = $item[1]; - $_items[] = $className::get()->byID($id); + $itemObj = $className::get()->byID($id); + if ($itemObj && $itemObj->exists()) { + $_items[] = $itemObj; + } } return $_items; }