From aeec10158441af3cef925ca55e531a4d5517d5ec Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Tue, 7 Jun 2022 16:03:25 -0700 Subject: Backfill tests and clean up --- hotline/transaction_handlers.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'hotline/transaction_handlers.go') diff --git a/hotline/transaction_handlers.go b/hotline/transaction_handlers.go index 20e7651..f4c5a2f 100644 --- a/hotline/transaction_handlers.go +++ b/hotline/transaction_handlers.go @@ -301,7 +301,7 @@ func HandleSendInstantMsg(cc *ClientConn, t *Transaction) (res []Transaction, er msg := t.GetField(fieldData) ID := t.GetField(fieldUserID) - reply := *NewTransaction( + reply := NewTransaction( tranServerMsg, &ID.Data, NewField(fieldData, msg.Data), @@ -316,12 +316,12 @@ func HandleSendInstantMsg(cc *ClientConn, t *Transaction) (res []Transaction, er reply.Fields = append(reply.Fields, NewField(fieldQuotingMsg, t.GetField(fieldQuotingMsg).Data)) } - res = append(res, reply) + res = append(res, *reply) id, _ := byteToInt(ID.Data) - otherClient := cc.Server.Clients[uint16(id)] - if otherClient == nil { - return res, errors.New("ohno") + otherClient, ok := cc.Server.Clients[uint16(id)] + if !ok { + return res, errors.New("invalid client ID") } // Respond with auto reply if other client has it enabled -- cgit