Skip to content

Commit

Permalink
Adds a safe navigation operator to avoid errors when viewing first re…
Browse files Browse the repository at this point in the history
…sult of a search
  • Loading branch information
Charlie Morris authored and cbeer committed Sep 30, 2020
1 parent 98fdffe commit 1a524fb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/helpers/blacklight/url_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def link_to_next_document(next_document)
# session_tracking_params(SolrDocument.new(id: 123), 7)
# => { data: { :'context-href' => '/catalog/123/track?counter=7&search_id=999' } }
def session_tracking_params document, counter
path = session_tracking_path(document, per_page: params.fetch(:per_page, search_session['per_page']), counter: counter, search_id: current_search_session.try(:id), document_id: document.id)
path = session_tracking_path(document, per_page: params.fetch(:per_page, search_session['per_page']), counter: counter, search_id: current_search_session.try(:id), document_id: document&.id)

if path.nil?
return {}
Expand Down

0 comments on commit 1a524fb

Please sign in to comment.