Skip to content

Commit

Permalink
fixes most obvious NRE
Browse files Browse the repository at this point in the history
  • Loading branch information
Szer committed Jan 22, 2024
1 parent 3e1a3c8 commit 8064735
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/VahterBanBot/Bot.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8064735

Please sign in to comment.