diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-23 16:03:51 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-23 16:03:51 -0700 |
| commit | c74c1f28b3db3a02630a7c80d0b98838a025fd90 (patch) | |
| tree | 77e6bc424b05ce20ebee735fc584ff900642813c | |
| parent | 0da28a1fe47ffc60e40aeca9dddd7ab37e52a999 (diff) | |
Handle invalid private chat ID case
| -rw-r--r-- | hotline/transaction_handlers.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hotline/transaction_handlers.go b/hotline/transaction_handlers.go index 7f29d73..26eee12 100644 --- a/hotline/transaction_handlers.go +++ b/hotline/transaction_handlers.go @@ -1782,7 +1782,10 @@ func HandleLeaveChat(cc *ClientConn, t *Transaction) (res []Transaction, err err chatID := t.GetField(fieldChatID).Data chatInt := binary.BigEndian.Uint32(chatID) - privChat := cc.Server.PrivateChats[chatInt] + privChat, ok := cc.Server.PrivateChats[chatInt] + if !ok { + return res, nil + } delete(privChat.ClientConn, cc.uint16ID()) |