FIX: topic might be night at this stage (#12929)

FIX: topic might be night at this stage (#12929)

diff --git a/lib/guardian/post_guardian.rb b/lib/guardian/post_guardian.rb
index ba26c09..156e19f 100644
--- a/lib/guardian/post_guardian.rb
+++ b/lib/guardian/post_guardian.rb
@@ -130,7 +130,7 @@ module PostGuardian
         SiteSetting.trusted_users_can_edit_others? &&
         @user.has_trust_level?(TrustLevel[4])
       ) ||
-      is_category_group_moderator?(post.topic.category)
+      is_category_group_moderator?(post.topic&.category)
     )
 
     if post.topic&.archived? || post.user_deleted || post.deleted_at

GitHub sha: 374ff4c5

This commit appears in #12929 which was approved by ZogStriP. It was merged by jjaffeux.