1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-05 03:23:50 +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 != "" { if rsp.Wording != "" {
return nil, errors.New(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 var texts []*TextDetection
for _, text := range rsp.OcrRspBody.TextDetections { for _, text := range rsp.OcrRspBody.TextDetections {
var points []*Coordinate var points []*Coordinate