From cc6540ec98c80f1b0e91c2e467a748c5353be27f Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 11 Mar 2021 21:05:12 +0800 Subject: [PATCH] Friend delete handling --- binary/utils.go | 3 --- client/multimsg.go | 7 ++++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/binary/utils.go b/binary/utils.go index 7ba3e34c..5ba6fabe 100644 --- a/binary/utils.go +++ b/binary/utils.go @@ -38,9 +38,6 @@ func GZipCompress(data []byte) []byte { } func GZipUncompress(src []byte) []byte { - if src == nil { - return nil - } b := bytes.NewReader(src) var out bytes.Buffer r, _ := gzip.NewReader(b) diff --git a/client/multimsg.go b/client/multimsg.go index 91d6dd92..81e3434e 100644 --- a/client/multimsg.go +++ b/client/multimsg.go @@ -119,10 +119,11 @@ func decodeMultiApplyDownResponse(_ *QQClient, _ *incomingPacketInfo, payload [] if err = proto.Unmarshal(data, &lb); err != nil { return nil, errors.Wrap(err, "failed to unmarshal protobuf message") } - uc := binary.GZipUncompress(lb.MsgDownRsp[0].MsgContent) - if uc == nil { - return nil, errors.New("failed to decompress gzip data") + msgContent := lb.MsgDownRsp[0].MsgContent + if msgContent == nil { + return nil, errors.New("message content is empty") } + uc := binary.GZipUncompress(msgContent) mt := msg.PbMultiMsgTransmit{} if err = proto.Unmarshal(uc, &mt); err != nil { return nil, errors.Wrap(err, "failed to unmarshal protobuf message")