From 72cbb5ffd3a0b995999bb8ea7b64c74eac7e1587 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Thu, 28 May 2020 04:27:15 +0200 Subject: [PATCH] Simplify some usages of client.error. --- client.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/client.go b/client.go index 7b0919c..bcb18e4 100644 --- a/client.go +++ b/client.go @@ -1376,8 +1376,7 @@ func handleClientMessage(c *client, m clientMessage) error { } case "op", "unop", "present", "unpresent": if !c.permissions.Op { - c.error(userError("not authorised")) - return nil + return c.error(userError("not authorised")) } err := setPermission(c.group, m.Id, m.Type) if err != nil { @@ -1385,8 +1384,7 @@ func handleClientMessage(c *client, m clientMessage) error { } case "lock", "unlock": if !c.permissions.Op { - c.error(userError("not authorised")) - return nil + return c.error(userError("not authorised")) } var locked uint32 if m.Type == "lock" { @@ -1395,8 +1393,7 @@ func handleClientMessage(c *client, m clientMessage) error { atomic.StoreUint32(&c.group.locked, locked) case "kick": if !c.permissions.Op { - c.error(userError("not authorised")) - return nil + return c.error(userError("not authorised")) } err := kickClient(c.group, m.Id) if err != nil {