FIX: check for existence of topic before looking for category

This commit is contained in:
Arpit Jalan 2018-05-17 10:49:01 +05:30
parent aee4045dd0
commit 392f184b24
1 changed files with 1 additions and 1 deletions

View File

@ -421,7 +421,7 @@ class UserNotifications < ActionMailer::Base
end end
# category name # category name
category = Topic.find_by(id: post.topic_id).category category = Topic.find_by(id: post.topic_id)&.category
if opts[:show_category_in_subject] && post.topic_id && category && !category.uncategorized? if opts[:show_category_in_subject] && post.topic_id && category && !category.uncategorized?
show_category_in_subject = category.name show_category_in_subject = category.name