Skip to content

Commit

Permalink
nil check
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcam-src committed Dec 3, 2024
1 parent 99c82b5 commit 9730a11
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9730a11

Please sign in to comment.