Commit 562fa646c3376ab9959683189380bdcbc38b5f87

Authored by Larissa Reis
1 parent 4694ee41

Fixes crash with submissions without profile

plugins/custom_forms/controllers/custom_forms_plugin_profile_controller.rb
@@ -17,7 +17,7 @@ class CustomFormsPluginProfileController < ProfileController @@ -17,7 +17,7 @@ class CustomFormsPluginProfileController < ProfileController
17 17
18 if request.post? 18 if request.post?
19 begin 19 begin
20 - raise 'Submission already present!' if CustomFormsPlugin::Submission.find_by_form_id_and_profile_id(@form.id,user.id) 20 + raise 'Submission already present!' if user.present? && CustomFormsPlugin::Submission.find_by_form_id_and_profile_id(@form.id,user.id)
21 21
22 # @submission.answers for some reason has the same answer twice 22 # @submission.answers for some reason has the same answer twice
23 failed_answers = answers.select {|answer| !answer.valid? } 23 failed_answers = answers.select {|answer| !answer.valid? }