Check if server exists in storage.User.SetNick()

This commit is contained in:
Ken-Håvard Lieng 2017-04-13 02:22:18 +02:00
parent 06977c9b44
commit 326161a563

View File

@ -165,11 +165,14 @@ func (u *User) SetNick(nick, address string) {
id := u.serverID(address)
server := Server{}
server.Unmarshal(b.Get(id))
server.Nick = nick
v := b.Get(id)
if v != nil {
server.Unmarshal(v)
server.Nick = nick
data, _ := server.Marshal(nil)
b.Put(id, data)
data, _ := server.Marshal(nil)
b.Put(id, data)
}
return nil
})