From e7afd181552af88f55609d7d39b978f33ed82faa Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Fri, 20 Oct 2023 13:31:20 +0300 Subject: [PATCH] DEV: Fix lazy_load_categories for uncategorized topic lists (#24028) --- app/models/topic_list.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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