Sandertv / gophertunnel

General purpose library for Minecraft Bedrock Edition software written in Go
MIT License
420 stars 96 forks source link

nil pointer error on receive the unknown packet #125

Closed PJZ9n closed 2 years ago

PJZ9n commented 2 years ago

invalid memory address or nil pointer dereference is raised when an unknown packet is sent from the server

backtrace:

This is an error when sending an unknown packet (ID: 0xFF) from the server

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x79353e]

goroutine 149 [running]:
github.com/sandertv/gophertunnel/minecraft.(*packetData).decode(0xc00008a7b0, 0xc0000bef00, 0x921120, 0xc000aea220, 0x0, 0x0)
        path/to/gophertunnel/minecraft/packet.go:41 +0x8e
github.com/sandertv/gophertunnel/minecraft.(*Conn).ReadPacket(0xc0000bef00, 0x91f9a0, 0xc00022a0a0, 0x0, 0x0)
        path/to/gophertunnel/minecraft/conn.go:344 +0x265
main.handleConn.func4(0xc0000bef00, 0xc0001382d0, 0xc0000be000)
        path/to/gophertunnel/main.go:89 +0xe6
created by main.handleConn
        path/to/gophertunnel/main.go:85 +0x2c9

commit id: 9a828f7f