Merge pull request #169 from iopred/patch-5
Fix potential threading issue.
This commit is contained in:
commit
83622cecfa
1 changed files with 4 additions and 4 deletions
8
state.go
8
state.go
|
@ -259,8 +259,6 @@ func (s *State) ChannelRemove(channel *Channel) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(s.channelMap, channel.ID)
|
|
||||||
|
|
||||||
if channel.IsPrivate {
|
if channel.IsPrivate {
|
||||||
s.Lock()
|
s.Lock()
|
||||||
|
@ -269,7 +267,7 @@ func (s *State) ChannelRemove(channel *Channel) error {
|
||||||
for i, c := range s.PrivateChannels {
|
for i, c := range s.PrivateChannels {
|
||||||
if c.ID == channel.ID {
|
if c.ID == channel.ID {
|
||||||
s.PrivateChannels = append(s.PrivateChannels[:i], s.PrivateChannels[i+1:]...)
|
s.PrivateChannels = append(s.PrivateChannels[:i], s.PrivateChannels[i+1:]...)
|
||||||
return nil
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -284,10 +282,12 @@ func (s *State) ChannelRemove(channel *Channel) error {
|
||||||
for i, c := range guild.Channels {
|
for i, c := range guild.Channels {
|
||||||
if c.ID == channel.ID {
|
if c.ID == channel.ID {
|
||||||
guild.Channels = append(guild.Channels[:i], guild.Channels[i+1:]...)
|
guild.Channels = append(guild.Channels[:i], guild.Channels[i+1:]...)
|
||||||
return nil
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete(s.channelMap, channel.ID)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue