GeyserMC / MCProtocolLib

A library for communication with a Minecraft client/server.
MIT License
728 stars 201 forks source link

Pinging servers from lower versions or with ViaVersions causes a NullPointerException #726

Closed geza3D closed 1 month ago

geza3D commented 1 year ago

The cause

This issue is caused by the fact that servers below 1.19.1 send the ClientboundStatusResponsePacket without the enforcesSecureChat boolean field (previously also known as the previewsChat boolean field). Since this field is non-existent in lower versions, trying to do a STATUS connection to a server from these versions will fail, and throw a NullPointerException.

The fix

Check if the field is null, and if it is, then default to false.

onebeastchris commented 1 month ago

We forgot to close this - it was fixed in https://github.com/GeyserMC/MCProtocolLib/commit/060a4ee6df05ca5b2a07e74193a9df386081e2f7. Thanks for reporting!