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)