1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

fix ocr panic.

This commit is contained in:
Mrs4s 2020-11-25 20:09:14 +08:00
parent b3233e604e
commit ad8bcb63aa

View File

@ -1009,6 +1009,9 @@ func decodeImageOcrResponse(_ *QQClient, _ uint16, payload []byte) (interface{},
if rsp.Wording != "" {
return nil, errors.New(rsp.Wording)
}
if rsp.RetCode != 0 {
return nil, errors.New(fmt.Sprintf("server error, code: %v msg: %v", rsp.RetCode, rsp.ErrMsg))
}
var texts []*TextDetection
for _, text := range rsp.OcrRspBody.TextDetections {
var points []*Coordinate