diff options
author | Hubert Hirtz <hubert@hirtz.pm> | 2020-11-23 16:37:55 +0100 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtz.pm> | 2020-11-23 16:37:55 +0100 |
commit | fd393976c50f28459cf93cb54be6cf392a56cc47 (patch) | |
tree | 988c42693bb33bcaf76234e0828d103aa1ee2cb4 /irc | |
parent | Polish the test client (diff) |
Don't forward outdated typing timeouts
The channel might have been parted, or the user might have parted from
the channel before receiving the timeout from Typings, thus causing a
segfault.
Diffstat (limited to 'irc')
-rw-r--r-- | irc/states.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/irc/states.go b/irc/states.go index dcfff1f..3f787b7 100644 --- a/irc/states.go +++ b/irc/states.go @@ -501,9 +501,17 @@ func (s *Session) run() { if !ok { break } + u, ok := s.users[t.Name] + if !ok { + break + } + c, ok := s.channels[t.Target] + if !ok { + break + } s.evts <- TagEvent{ - User: s.users[t.Name].Name, - Target: s.channels[t.Target].Name, + User: u.Name, + Target: c.Name, Typing: TypingDone, Time: time.Now(), } |