- Issue created by @mr.baileys
When indexing, I'm running into a fatal error:
[error] Error: Call to a member function hasWarnings() on null in Drupal\search_api\Entity\Index->indexSpecificItems() (line 1057 of /var/www/html/docroot/modules/contrib/search_api/src/Entity/Index.php) #0 /var/www/html/docroot/modules/contrib/search_api/src/Entity/Index.php(974): Drupal\search_api\Entity\Index->indexSpecificItems(Array)
Looking at the code
$item = $items[$item_id] ?? NULL;
if ($item->hasWarnings()) {
$items_with_warnings[$item_id] = $item_id;
}
$item can be null, since ?? is used, so the next statement should take this into account. Something like:
$item = $items[$item_id] ?? NULL;
if ($item && $item->hasWarnings()) {
$items_with_warnings[$item_id] = $item_id;
}
Needs review
1.0
General code