diff --git a/app/models/procedure.rb b/app/models/procedure.rb index e1a67e0fb..e0cc03d12 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -189,7 +189,7 @@ class Procedure < ApplicationRecord def generate_export exportable_dossiers = dossiers.downloadable_sorted - headers = exportable_dossiers.any? ? exportable_dossiers.first.export_headers : [] + headers = exportable_dossiers&.first&.export_headers || [] data = exportable_dossiers.any? ? exportable_dossiers.map { |d| d.full_data_strings_array } : [[]] {