Fix: Check for nil from cmap Get

This commit is contained in:
kayos@tcp.direct 2022-07-14 01:47:52 -07:00
parent 32f2b078c3
commit 9083cf55cf
Signed by: kayos
GPG Key ID: 4B841471B4BEE979
2 changed files with 4 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.idea .idea
*.save *.save
*.swp *.swp
corpus/

View File

@ -421,7 +421,9 @@ func (p *UserPerms) MarshalJSON() ([]byte, error) {
func (p *UserPerms) Lookup(channel string) (perms Perms, ok bool) { func (p *UserPerms) Lookup(channel string) (perms Perms, ok bool) {
var permsi interface{} var permsi interface{}
permsi, ok = p.channels.Get(ToRFC1459(channel)) permsi, ok = p.channels.Get(ToRFC1459(channel))
perms = permsi.(Perms) if ok {
perms = permsi.(Perms)
}
return perms, ok return perms, ok
} }