TibiaData / tibiadata-api-go

TibiaData API written in Golang and deployed in container (version v3 and above).
https://api.tibiadata.com
MIT License
81 stars 27 forks source link

[bug] characters with too many deaths cause crash #271

Closed tobiasehlert closed 11 months ago

tobiasehlert commented 11 months ago

The applications panics when character has too many deaths.

Last line of deaths table shows this: There happened more character deaths in the last 30 days than we can display here.

URL:

Error from log:

2023/10/09 20:27:23 [warning] TibiaDataStringToInteger: couldn't convert string into int. error: strconv.Atoi: parsing "ppened": invalid syntax

[GIN] 2023/10/09 - 20:27:23 | 200 |   104.78069ms |   10.233.86.153 | GET      "/v4/character/Stalone Matador"

2023/10/09 20:27:23 [Recovery] 2023/10/09 - 20:27:23 panic recovered:
runtime error: slice bounds out of range [2:1]
/usr/local/go/src/runtime/panic.go:154 (0x433edb)
/go/src/src/TibiaCharactersCharacter.go:446 (0x7bb8f0)
/go/pkg/mod/github.com/!puerkito!bio/goquery@v1.8.1/iteration.go:21 (0x6e0bb4)
/go/src/src/TibiaCharactersCharacter.go:375 (0x7b9fa6)
/go/pkg/mod/github.com/!puerkito!bio/goquery@v1.8.1/iteration.go:21 (0x6e0bb4)
/go/src/src/TibiaCharactersCharacter.go:151 (0x7b97d8)
/go/src/src/webserver.go:310 (0x7d9037)
/go/src/src/webserver.go:1118 (0x7d6ffb)
/go/src/src/webserver.go:306 (0x7d2550)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x7b7e65)
/go/pkg/mod/github.com/gin-contrib/gzip@v0.0.6/handler.go:60 (0x7b7e47)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x7adad9)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102 (0x7adac7)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x7acc7d)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/logger.go:240 (0x7acc4c)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x7abd3a)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620 (0x7ab9cd)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576 (0x7ab67c)
/usr/local/go/src/net/http/server.go:2938 (0x64874d)
/usr/local/go/src/net/http/server.go:2009 (0x645693)
/usr/local/go/src/runtime/asm_amd64.s:1650 (0x468240)
Deci-ON commented 11 months ago

Following