From 46bde0c01955cddc5b0da547f76629583f568ca4 Mon Sep 17 00:00:00 2001 From: chris Date: Sun, 31 Dec 2023 02:24:44 +0100 Subject: [PATCH] Fix: protocol being null during online mode login (#4369) * fix: protocol being null during online mode login * gimme more space * add debug logging for too early downstream packet sending --- .../java/org/geysermc/geyser/session/GeyserSession.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 28ad5887c..26e206458 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -1633,6 +1633,15 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { * @param intendedState the state the client should be in */ public void sendDownstreamPacket(Packet packet, ProtocolState intendedState) { + // protocol can be null when we're not yet logged in (online auth) + if (protocol == null) { + if (geyser.getConfig().isDebugMode()) { + geyser.getLogger().debug("Tried to send downstream packet with no downstream session!"); + Thread.dumpStack(); + } + return; + } + if (protocol.getState() != intendedState) { geyser.getLogger().debug("Tried to send " + packet.getClass().getSimpleName() + " packet while not in " + intendedState.name() + " state"); return;