diff --git a/app/models/community_user.rb b/app/models/community_user.rb
index ee9e90fd7e9341ef57817455d14dd0a5794bd600..f0a80e60fc035ca7e38489593e46f3a8a0076b88 100644
--- a/app/models/community_user.rb
+++ b/app/models/community_user.rb
@@ -31,7 +31,7 @@ class CommunityUser < ApplicationRecord
   end
 
   def latest_warning
-    mod_warnings&.order(created_at: 'desc').first.created_at
+    mod_warnings&.order(created_at: 'desc')&.first&.created_at
   end
 
   # Calculation functions for privilege scores