diff --git a/app/models/category.rb b/app/models/category.rb
index bbd9ee6556f..cf639d33eec 100644
--- a/app/models/category.rb
+++ b/app/models/category.rb
@@ -111,7 +111,7 @@ class Category < ActiveRecord::Base
     topics = Topic
                .select("COUNT(*) topic_count")
                .where("topics.category_id = categories.id")
-               .where("categories.topic_id <> topics.id")
+               .where("categories.topic_id <> topics.id OR categories.topic_id is null")
                .visible
 
     topics_with_post_count = Topic