Fix JSON.parse crashing on empty values
This commit is contained in:
parent
e2063e0fc8
commit
e7ba380d95
2 changed files with 4 additions and 2 deletions
|
@ -72,7 +72,8 @@ module Instructeurs
|
|||
end
|
||||
|
||||
def send_to_instructeurs
|
||||
recipients = Instructeur.find(JSON.parse(params[:recipients]))
|
||||
recipients = params['recipients'].presence || [].to_json
|
||||
recipients = Instructeur.find(JSON.parse(recipients))
|
||||
|
||||
recipients.each do |recipient|
|
||||
recipient.follow(dossier)
|
||||
|
|
|
@ -138,7 +138,8 @@ module Instructeurs
|
|||
end
|
||||
|
||||
def update_displayed_fields
|
||||
procedure_presentation.update_displayed_fields(JSON.parse(params[:values]))
|
||||
values = params['values'].presence || [].to_json
|
||||
procedure_presentation.update_displayed_fields(JSON.parse(values))
|
||||
|
||||
redirect_back(fallback_location: instructeur_procedure_url(procedure))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue