From 392f184b24f30cc42f62c94662fc609681e3e7d9 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 17 May 2018 10:49:01 +0530 Subject: [PATCH] FIX: check for existence of topic before looking for category --- app/mailers/user_notifications.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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