3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-13 07:29:30 +01:00

modes: Kill a crash

This commit is contained in:
Daniel Oaks 2017-03-26 22:09:46 +10:00
parent a8e13b062b
commit cec3416eae

View File

@ -526,14 +526,14 @@ func cmodeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
channelName, err := CasefoldChannel(msg.Params[0]) channelName, err := CasefoldChannel(msg.Params[0])
channel := server.channels.Get(channelName) channel := server.channels.Get(channelName)
channel.membersMutex.Lock()
defer channel.membersMutex.Unlock()
if err != nil || channel == nil { if err != nil || channel == nil {
client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, msg.Params[0], "No such channel") client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, msg.Params[0], "No such channel")
return false return false
} }
channel.membersMutex.Lock()
defer channel.membersMutex.Unlock()
// applied mode changes // applied mode changes
applied := make(ModeChanges, 0) applied := make(ModeChanges, 0)