From 6481a83c72a075781c16351fd7dabcd65d1f9f7d Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Tue, 10 Mar 2015 11:36:04 +0200
Subject: [PATCH] Check that the missing record has an ID before trying to load
 it from the database.

---
 module/VuFind/src/VuFind/RecordDriver/Missing.php | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/module/VuFind/src/VuFind/RecordDriver/Missing.php b/module/VuFind/src/VuFind/RecordDriver/Missing.php
index fec3e170d11..90bcf2ed3df 100644
--- a/module/VuFind/src/VuFind/RecordDriver/Missing.php
+++ b/module/VuFind/src/VuFind/RecordDriver/Missing.php
@@ -62,11 +62,14 @@ class Missing extends SolrDefault
     public function determineMissingTitle()
     {
         // If available, load title from database:
-        $table = $this->getDbTable('Resource');
-        $resource = $table
-            ->findResource($this->getUniqueId(), $this->getResourceSource(), false);
-        if (!empty($resource) && !empty($resource->title)) {
-            return $resource->title;
+        $id = $this->getUniqueId();
+        if ($id) {
+            $table = $this->getDbTable('Resource');
+            $resource = $table
+                ->findResource($id, $this->getResourceSource(), false);
+            if (!empty($resource) && !empty($resource->title)) {
+                return $resource->title;
+            }
         }
 
         // Default -- message about missing title:
-- 
GitLab