Browse Source

fix a crash when SAMODE'ing in a channel you're not joined to

tags/v0.12.0
Shivaram Lingamneni 5 years ago
parent
commit
a18283e2de
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      irc/channel.go

+ 5
- 2
irc/channel.go View File

@@ -239,9 +239,12 @@ func (channel *Channel) Names(client *Client, rb *ResponseBuffer) {
239 239
 // ClientIsAtLeast returns whether the client has at least the given channel privilege.
240 240
 func (channel *Channel) ClientIsAtLeast(client *Client, permission modes.Mode) bool {
241 241
 	channel.stateMutex.RLock()
242
-	defer channel.stateMutex.RUnlock()
243
-
244 242
 	clientModes := channel.members[client]
243
+	channel.stateMutex.RUnlock()
244
+
245
+	if clientModes == nil {
246
+		return false
247
+	}
245 248
 
246 249
 	for _, mode := range modes.ChannelUserModes {
247 250
 		if clientModes.HasMode(mode) {

Loading…
Cancel
Save