Mrs4s / go-cqhttp

cqhttp的golang实现,轻量、原生跨平台.
GNU Affero General Public License v3.0
10.39k stars 1.63k forks source link

[Bug]: runtime error: index out of range [0] with length 0 #2517

Open airdm opened 9 months ago

airdm commented 9 months ago

请确保您已阅读以上注意事项,并勾选下方的确认框。

go-cqhttp 版本

1.2.0

运行环境

Windows (64)

运行架构

None

连接方式

HTTP

使用协议

6 | aPad

重现步骤

启动时出现的,我也不知道是怎么出现的.

期望的结果是什么?

汇报BUG

实际的结果是什么?

汇报BUG

简单的复现代码/链接(可选)

No response

日志记录(可选)

2024/02/06 19:30:49 http: panic serving 127.0.0.1:31318: runtime error: index out of range [0] with length 0
goroutine 337 [running]:
net/http.(*conn).serve.func1()
        net/http/server.go:1854 +0xbf
panic({0x1623040, 0xc000214018})
        runtime/panic.go:890 +0x263
github.com/Mrs4s/MiraiGo/client/internal/highway.(*Session).nextAddr(0x17746e0?)
        github.com/Mrs4s/MiraiGo@v0.0.0-20230823050531-a8213e127b2b/client/internal/highway/highway.go:227 +0xfd
github.com/Mrs4s/MiraiGo/client/internal/highway.(*Session).selectConn(0xc0003cd140?)
        github.com/Mrs4s/MiraiGo@v0.0.0-20230823050531-a8213e127b2b/client/internal/highway/highway.go:248 +0xe5
github.com/Mrs4s/MiraiGo/client/internal/highway.(*Session).uploadSingle(0xc00020e240, {0x4c, {0x1774700, 0xc00020c300}, {0xc000232290, 0x10, 0x10}, 0xab84, {0x0, 0x0, ...}, ...})
        github.com/Mrs4s/MiraiGo@v0.0.0-20230823050531-a8213e127b2b/client/internal/highway/bdh.go:39 +0x68
github.com/Mrs4s/MiraiGo/client/internal/highway.(*Session).Upload(0xc00020e240, {0x4c, {0x1774700, 0xc00020c300}, {0xc000232290, 0x10, 0x10}, 0xab84, {0x0, 0x0, ...}, ...})
        github.com/Mrs4s/MiraiGo@v0.0.0-20230823050531-a8213e127b2b/client/internal/highway/bdh.go:117 +0x425
github.com/Mrs4s/MiraiGo/client.(*QQClient).uploadOcrImage(0xc000222000, {0x1774700, 0xc00020c300}, 0xab84, {0xc000232290, 0x10, 0x10})
        github.com/Mrs4s/MiraiGo@v0.0.0-20230823050531-a8213e127b2b/client/image.go:311 +0x218
github.com/Mrs4s/MiraiGo/client.(*QQClient).ImageOcr(0xc0003e6609?, {0x15bafc0?, 0xc0005a8240})
        github.com/Mrs4s/MiraiGo@v0.0.0-20230823050531-a8213e127b2b/client/image.go:194 +0xd8
github.com/Mrs4s/go-cqhttp/coolq.(*CQBot).CQOcrImage(0xc0000ca480, {0xc0003e660a?, 0x28?})
        github.com/Mrs4s/go-cqhttp/coolq/api.go:1878 +0x445
github.com/Mrs4s/go-cqhttp/modules/api.(*Caller).call(0xc000190020, {0xc00001e786, 0x9?}, 0x1b25620, {0x1773e60, 0xc000095260})
        github.com/Mrs4s/go-cqhttp/modules/api/api.go:86 +0x2e85
github.com/Mrs4s/go-cqhttp/modules/api.(*Caller).Call(0xc000190020, {0xc00001e786, 0x9}, 0xc00044a9b8?, {0x1773e60, 0xc000095260})
        github.com/Mrs4s/go-cqhttp/modules/api/caller.go:35 +0xc5
github.com/Mrs4s/go-cqhttp/server.(*httpServer).ServeHTTP(0xc000190000, {0x1777e70, 0xc00016a380}, 0xc000490400)
        github.com/Mrs4s/go-cqhttp/server/http.go:213 +0x8ba
net/http.serverHandler.ServeHTTP({0x17767b8?}, {0x1777e70, 0xc00016a380}, 0xc000490400)
        net/http/server.go:2936 +0x316
net/http.(*conn).serve(0xc000448480, {0x1778360, 0xc000168d80})
        net/http/server.go:1995 +0x612
created by net/http.(*Server).Serve
        net/http/server.go:3089 +0x5ed

补充说明(可选)

No response

kkgg0521 commented 8 months ago

登陆后 没有获取到媒体服务器地址导致的

SudoSuBash commented 8 months ago

登陆后 没有获取到媒体服务器地址导致的

那我该怎么解决呢?求个解决方法

SudoSuBash commented 8 months ago

登陆后 没有获取到媒体服务器地址导致的

确实是有时候有效,当我翻墙的时候,它有一定几率可以正常运作。 然后我通过修改源码的方式获取到了媒体服务器地址,但是它的地址在加拿大。 问下大佬这是什么情况?为什么服务器地址会在加拿大?国内的没有吗?

Image_1708762797306.png