From 53fd47b5e3370a1509d2a11a6cbf3ba2b40aba54 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Wed, 20 Jun 2018 16:19:53 -0400
Subject: [PATCH] Fix unset driver in similar items channel provider.

---
 module/VuFind/src/VuFind/ChannelProvider/SimilarItems.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/module/VuFind/src/VuFind/ChannelProvider/SimilarItems.php b/module/VuFind/src/VuFind/ChannelProvider/SimilarItems.php
index 62b60f5f2d0..9c01d2ca719 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();
-- 
GitLab