Commit 562fa646c3376ab9959683189380bdcbc38b5f87
1 parent
4694ee41
Exists in
master
and in
29 other branches
Fixes crash with submissions without profile
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
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? } |