Add null check to NetworkHooks.openScreen. Closes #9597

This commit is contained in:
LexManos committed 2023-07-03 17:24:26 -07:00
1 parent b34275988c
commit 47ed2ad401
1 file changed
+3 -1
@@ -201,7 +201,9 @@ public class NetworkHooks
if (output.readableBytes() > 32600 || output.readableBytes() < 1) {
throw new IllegalArgumentException("Invalid PacketBuffer for openGui, found "+ output.readableBytes()+ " bytes");
}
AbstractContainerMenu c = containerSupplier.createMenu(openContainerId, player.getInventory(), player);
var c = containerSupplier.createMenu(openContainerId, player.getInventory(), player);
if (c == null)
return;
MenuType<?> type = c.getType();
PlayMessages.OpenContainer msg = new PlayMessages.OpenContainer(type, openContainerId, containerSupplier.getDisplayName(), output);
NetworkConstants.playChannel.sendTo(msg, player.connection.connection, NetworkDirection.PLAY_TO_CLIENT);