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 17  
18 18 if request.post?
19 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 22 # @submission.answers for some reason has the same answer twice
23 23 failed_answers = answers.select {|answer| !answer.valid? }
... ...