From 3b5245dc548073ac35e615b58dd5cb2c67485e08 Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Wed, 7 Aug 2024 14:22:32 -0300 Subject: [PATCH] FIX: Handle nil reply_to_post in AI Bot event handler (#743) Somehow it's possible to have a nil `post.reply_to_post` with a non-nil `post.reply_to_post_number`. --- lib/ai_bot/playground.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ai_bot/playground.rb b/lib/ai_bot/playground.rb index bc621e35..a294ae76 100644 --- a/lib/ai_bot/playground.rb +++ b/lib/ai_bot/playground.rb @@ -80,7 +80,7 @@ module DiscourseAi mentions = post.mentions.map(&:downcase) # in case we are replying to a post by a bot - if post.reply_to_post_number && post.reply_to_post.user + if post.reply_to_post_number && post.reply_to_post&.user mentions << post.reply_to_post.user.username_lower end