go-cqhttp icon indicating copy to clipboard operation
go-cqhttp copied to clipboard

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

Open airdm opened this issue 1 year ago • 3 comments

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

  • [X] 我已经仔细阅读上述教程和 "提问前需知"
  • [X] 我已经使用 dev分支版本 测试过,问题依旧存在。
  • [X] 我已经在 Issue Tracker 中找过我要提出的问题,没有找到相同问题的ISSUE。
  • [X] 我已知晓并同意,此处仅用于汇报程序中存在的问题。若这个 Issue 是关于其他非程序本身问题,则我的 Issue 可能会被无条件自动关闭或/并锁定。(这些问题应当在 Discussion 板块提出。)

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/[email protected]/client/internal/highway/highway.go:227 +0xfd
github.com/Mrs4s/MiraiGo/client/internal/highway.(*Session).selectConn(0xc0003cd140?)
        github.com/Mrs4s/[email protected]/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/[email protected]/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/[email protected]/client/internal/highway/bdh.go:117 +0x425
github.com/Mrs4s/MiraiGo/client.(*QQClient).uploadOcrImage(0xc000222000, {0x1774700, 0xc00020c300}, 0xab84, {0xc000232290, 0x10, 0x10})
        github.com/Mrs4s/[email protected]/client/image.go:311 +0x218
github.com/Mrs4s/MiraiGo/client.(*QQClient).ImageOcr(0xc0003e6609?, {0x15bafc0?, 0xc0005a8240})
        github.com/Mrs4s/[email protected]/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

airdm avatar Feb 06 '24 11:02 airdm

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

kkgg0521 avatar Feb 11 '24 09:02 kkgg0521

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

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

SudosuBash avatar Feb 23 '24 04:02 SudosuBash

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

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

Image_1708762797306.png

  • [x] Image_1708762799334.png

SudosuBash avatar Feb 24 '24 08:02 SudosuBash