From c74c1f28b3db3a02630a7c80d0b98838a025fd90 Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Thu, 23 Jun 2022 16:03:51 -0700 Subject: Handle invalid private chat ID case --- hotline/transaction_handlers.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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()) -- cgit