From 9730a113146ba5b09e12fe74b4ba285cb64fc1e6 Mon Sep 17 00:00:00 2001 From: David Campbell Date: Tue, 3 Dec 2024 14:06:25 -0500 Subject: [PATCH] nil check --- .../presenters/blacklight/thumbnail_presenter_override.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/overrides/presenters/blacklight/thumbnail_presenter_override.rb b/app/overrides/presenters/blacklight/thumbnail_presenter_override.rb index c4925ebba..4eb84cfbe 100644 --- a/app/overrides/presenters/blacklight/thumbnail_presenter_override.rb +++ b/app/overrides/presenters/blacklight/thumbnail_presenter_override.rb @@ -30,6 +30,11 @@ def retrieve_values(field_config) # Extract the SolrDocument from the document if it's nested # Prevents errors when the document is a presenter on work show pages def extract_solr_document(doc) + unless doc + Rails.logger.warn("Attempted to extract SolrDocument but document is nil for document with id #{doc.id}") + return nil + end + if doc.is_a?(SolrDocument) doc elsif doc.respond_to?(:solr_document) && doc.solr_document.is_a?(SolrDocument)