mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 20:09:41 +01:00
fix a crash when SAMODE'ing in a channel you're not joined to
This commit is contained in:
parent
4ecdea0647
commit
a18283e2de
@ -239,9 +239,12 @@ func (channel *Channel) Names(client *Client, rb *ResponseBuffer) {
|
|||||||
// ClientIsAtLeast returns whether the client has at least the given channel privilege.
|
// ClientIsAtLeast returns whether the client has at least the given channel privilege.
|
||||||
func (channel *Channel) ClientIsAtLeast(client *Client, permission modes.Mode) bool {
|
func (channel *Channel) ClientIsAtLeast(client *Client, permission modes.Mode) bool {
|
||||||
channel.stateMutex.RLock()
|
channel.stateMutex.RLock()
|
||||||
defer channel.stateMutex.RUnlock()
|
|
||||||
|
|
||||||
clientModes := channel.members[client]
|
clientModes := channel.members[client]
|
||||||
|
channel.stateMutex.RUnlock()
|
||||||
|
|
||||||
|
if clientModes == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
for _, mode := range modes.ChannelUserModes {
|
for _, mode := range modes.ChannelUserModes {
|
||||||
if clientModes.HasMode(mode) {
|
if clientModes.HasMode(mode) {
|
||||||
|
Loading…
Reference in New Issue
Block a user