Skip to content

Commit

Permalink
Merge pull request #2 from jgknight/fix-anon-warning
Browse files Browse the repository at this point in the history
Don't crash on anonymous warning
  • Loading branch information
mk6i authored Jun 4, 2024
2 parents d5ed9c6 + d0b8ead commit a16ec14
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,16 @@ func reactToWarning(
) error {

chatMsg := wire.SNAC_0x01_0x10_OServiceEvilNotification{}
if err := wire.Unmarshal(&chatMsg, flapBody); err != nil {
// io.EOF can be due to an empty OServiceEvilNotification SNAC
// which indicates an anonymous warning, so ignore it
if err := wire.Unmarshal(&chatMsg, flapBody); err != nil && err != io.EOF {
return err
}

chatCtx, ok := chatContexts[chatMsg.ScreenName]
// chatMsg.ScreenName is "" (anonymous), or hasn't sent us an IM yet
if !ok {
logger.Debug("trying to send warning, but can't find chat context, moving on")
logger.Debug("can't find chat context, moving on")
return nil
}

Expand Down

0 comments on commit a16ec14

Please sign in to comment.