nxtrace / NTrace-core

NextTrace, an open source visual route tracking CLI tool
https://www.nxtrace.org
GNU General Public License v3.0
5.9k stars 348 forks source link

fix: close when `createWsConn` failed #259

Closed dyxushuai closed 2 months ago

dyxushuai commented 2 months ago

Attempting to close a WsConn after a failed creation will result in a panic.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1029e8708]

goroutine 1 [running]:
github.com/gorilla/websocket.(*Conn).Close(0x14000192180?)
        github.com/gorilla/websocket@v1.5.2/conn.go:344 +0x18
github.com/nxtrace/NTrace-core/cmd.Excute.func1()
        github.com/nxtrace/NTrace-core/cmd/cmd.go:188 +0x24
github.com/nxtrace/NTrace-core/cmd.Excute()
        github.com/nxtrace/NTrace-core/cmd/cmd.go:359 +0x1d34
main.main()
        github.com/nxtrace/NTrace-core/main.go:8 +0x1c
tsosunchia commented 2 months ago

Please note: We welcome PR submissions from the community, but please submit your PRs to the NTrace-V1 repository instead of NTrace-core repository.

NTrace-V1 是本项目的开发环境,NTrace-core 不直接进行代码变更,而是定期从 NTrace-V1 同步代码。

感谢您的PR,烦请转至 NTrace-V1 仓库提交,谢谢。