check if attributes exist

Fixing https://appsignal.com/ministry-of-justice-digital-services-division/sites/524452bc843e1f55ca000003/exceptions/CourtsController-index/ActionView::Template::Error