Commit bd9bbf38071f1a4572a95009987b0b50165eb2c7
1 parent
852b5dff
Exists in
master
and in
29 other branches
[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 | 21 | def welcome |
22 | 22 | self.class.no_design_blocks |
23 | 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 | 26 | end |
27 | 27 | |
28 | 28 | end | ... | ... |