mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
client: try fix panic in decodeMultiApplyDownResponse
This commit is contained in:
parent
e9f4d33002
commit
a8d1e40a27
@ -97,15 +97,23 @@ func decodeMultiApplyDownResponse(_ *QQClient, _ *network.IncomingPacketInfo, pa
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
}
|
||||
if len(body.MultimsgApplydownRsp) == 0 {
|
||||
return nil, errors.New("not found")
|
||||
return nil, errors.New("message not found")
|
||||
}
|
||||
rsp := body.MultimsgApplydownRsp[0]
|
||||
|
||||
if rsp.ThumbDownPara == nil {
|
||||
return nil, errors.New("message not found")
|
||||
}
|
||||
|
||||
var prefix string
|
||||
if rsp.MsgExternInfo != nil && rsp.MsgExternInfo.ChannelType == 2 {
|
||||
prefix = "https://ssl.htdata.qq.com"
|
||||
} else {
|
||||
prefix = fmt.Sprintf("http://%s:%d", binary.UInt32ToIPV4Address(uint32(rsp.Uint32DownIp[0])), body.MultimsgApplydownRsp[0].Uint32DownPort[0])
|
||||
ma := body.MultimsgApplydownRsp[0]
|
||||
if len(rsp.Uint32DownIp) == 0 || len(ma.Uint32DownPort) == 0 {
|
||||
return nil, errors.New("message not found")
|
||||
}
|
||||
prefix = fmt.Sprintf("http://%s:%d", binary.UInt32ToIPV4Address(uint32(rsp.Uint32DownIp[0])), ma.Uint32DownPort[0])
|
||||
}
|
||||
b, err := utils.HttpGetBytes(fmt.Sprintf("%s%s", prefix, string(rsp.ThumbDownPara)), "")
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user