Fix potential threading issue.
This commit is contained in:
parent
f654ec2a42
commit
a9bed749a1
1 changed files with 4 additions and 4 deletions
8
state.go
8
state.go
|
@ -260,8 +260,6 @@ func (s *State) ChannelRemove(channel *Channel) error {
|
|||
return err
|
||||
}
|
||||
|
||||
delete(s.channelMap, channel.ID)
|
||||
|
||||
if channel.IsPrivate {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
@ -269,7 +267,7 @@ func (s *State) ChannelRemove(channel *Channel) error {
|
|||
for i, c := range s.PrivateChannels {
|
||||
if c.ID == channel.ID {
|
||||
s.PrivateChannels = append(s.PrivateChannels[:i], s.PrivateChannels[i+1:]...)
|
||||
return nil
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -284,11 +282,13 @@ func (s *State) ChannelRemove(channel *Channel) error {
|
|||
for i, c := range guild.Channels {
|
||||
if c.ID == channel.ID {
|
||||
guild.Channels = append(guild.Channels[:i], guild.Channels[i+1:]...)
|
||||
return nil
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete(s.channelMap, channel.ID)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue