Commit bd9bbf38071f1a4572a95009987b0b50165eb2c7

Authored by Rodrigo Souto
1 parent 852b5dff

[template-welcome-page] Avoid crash on welcome page when there is no template

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
app/controllers/public/home_controller.rb
@@ -21,8 +21,8 @@ class HomeController < PublicController @@ -21,8 +21,8 @@ class HomeController < PublicController
21 def welcome 21 def welcome
22 self.class.no_design_blocks 22 self.class.no_design_blocks
23 @display_confirmation_tips = !user.present? && !environment.enabled?(:skip_new_user_email_confirmation) 23 @display_confirmation_tips = !user.present? && !environment.enabled?(:skip_new_user_email_confirmation)
24 - @person_template = Person.find(params[:template_id])  
25 - @template_welcome_page = @person_template.welcome_page && @person_template.welcome_page.published ? @person_template.welcome_page.body : nil 24 + @person_template = user && user.template || params[:template_id] && Person.find(params[:template_id])
  25 + @template_welcome_page = @person_template && @person_template.welcome_page && @person_template.welcome_page.published ? @person_template.welcome_page.body : nil
26 end 26 end
27 27
28 end 28 end