From e02ad4249e845437097d2bf7e8841965815e6914 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 30 Oct 2017 11:59:13 -0400 Subject: [PATCH] FIX: In case that `category` is `nil` it should not throw an error --- app/models/topic.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/topic.rb b/app/models/topic.rb index fe15c98f00b..b2557df7b34 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -645,7 +645,7 @@ SQL Category.where(id: new_category.id).update_all("topic_count = topic_count + 1") CategoryFeaturedTopic.feature_topics_for(old_category) unless @import_mode - CategoryFeaturedTopic.feature_topics_for(new_category) unless @import_mode || old_category.id == new_category.id + CategoryFeaturedTopic.feature_topics_for(new_category) unless @import_mode || old_category.try(:id) == new_category.id end true