From 80647355aabd14fef5ec6918e8f58a3db33209ea Mon Sep 17 00:00:00 2001 From: Ayrat Hudaygulov Date: Mon, 22 Jan 2024 16:13:24 +0000 Subject: [PATCH] fixes most obvious NRE --- src/VahterBanBot/Bot.fs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/VahterBanBot/Bot.fs b/src/VahterBanBot/Bot.fs index e0f7e43..c1d12a3 100644 --- a/src/VahterBanBot/Bot.fs +++ b/src/VahterBanBot/Bot.fs @@ -389,15 +389,16 @@ let onUpdate (message: Message) = task { use banOnReplyActivity = botActivity.StartActivity("onUpdate") - %banOnReplyActivity - .SetTag("chatId", message.Chat.Id) - .SetTag("chatUsername", message.Chat.Username) // early return if if we can't process it if isNull message || isNull message.From then logger.LogWarning "Received update without message" else + %banOnReplyActivity + .SetTag("chatId", message.Chat.Id) + .SetTag("chatUsername", message.Chat.Username) + // upserting user to DB let! _ = DbUser.newUser message.From