FIX: In case that `category` is `nil` it should not throw an error

This commit is contained in:
Robin Ward 2017-10-30 11:59:13 -04:00
parent 9705f8b9c2
commit e02ad4249e
1 changed files with 1 additions and 1 deletions

View File

@ -645,7 +645,7 @@ SQL
Category.where(id: new_category.id).update_all("topic_count = topic_count + 1") 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(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 end
true true