diff --git a/src/Entity/Index.php b/src/Entity/Index.php
index c449fd8c..d2bb4074 100644
--- a/src/Entity/Index.php
+++ b/src/Entity/Index.php
@@ -1061,7 +1061,7 @@ class Index extends ConfigEntityBase implements IndexInterface {
       $items_with_warnings = [];
       foreach ($indexed_ids as $item_id) {
         $item = $items[$item_id] ?? NULL;
-        if ($item->hasWarnings()) {
+        if ($item && $item->hasWarnings()) {
           $items_with_warnings[$item_id] = $item_id;
         }
       }
