diff --git a/module/VuFind/src/VuFind/ChannelProvider/SimilarItems.php b/module/VuFind/src/VuFind/ChannelProvider/SimilarItems.php
index 62b60f5f2d06f19312dcab40e75682b6b79d8beb..9c01d2ca71993d7e9eeab63d7c2a323e03284c73 100644
--- a/module/VuFind/src/VuFind/ChannelProvider/SimilarItems.php
+++ b/module/VuFind/src/VuFind/ChannelProvider/SimilarItems.php
@@ -162,7 +162,10 @@ class SimilarItems extends AbstractChannelProvider
         }
         // If the search results did not include the object we were looking for,
         // we need to fetch it from the search service:
-        if (empty($channels) && is_object($driver) && $channelToken !== null) {
+        if (empty($channels)
+            && is_object($driver ?? null)
+            && $channelToken !== null
+        ) {
             $driver = $this->searchService->retrieve(
                 $driver->getSourceIdentifier(), $channelToken
             )->first();