diff --git a/app/models/topic_list.rb b/app/models/topic_list.rb index 4e021e87369..1071f573741 100644 --- a/app/models/topic_list.rb +++ b/app/models/topic_list.rb @@ -77,7 +77,8 @@ class TopicList end def categories - @categories ||= topics.map { |t| [t.category, t.category.parent_category] }.uniq.flatten.compact + @categories ||= + topics.map { |t| [t.category, t.category&.parent_category] }.uniq.flatten.compact end def load_topics