Skip to content

A platform for community discussion. Free, open, simple.

FIX: check for existence of topic before looking for category

Arpit Jalan392f184b24f3
diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb
index cda60d28970..5e8a60af06b 100644
--- a/app/mailers/user_notifications.rb
+++ b/app/mailers/user_notifications.rb
@@ -421,7 +421,7 @@ class UserNotifications < ActionMailer::Base
end
# 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?
show_category_in_subject = category.name