From c8cd3a03725b53597cf14505c6bbc38b2ef0052f Mon Sep 17 00:00:00 2001 From: Jab125 <67534807+Jab125@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:18:59 +1100 Subject: [PATCH] make sure `Legacy4JData` isn't null when reading from it --- .../dev/jab125/hotjoin/compat/legacy4j/Legacy4JModCompat.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/jab125/hotjoin/compat/legacy4j/Legacy4JModCompat.java b/src/main/java/dev/jab125/hotjoin/compat/legacy4j/Legacy4JModCompat.java index 89f0bc6..2c07b00 100644 --- a/src/main/java/dev/jab125/hotjoin/compat/legacy4j/Legacy4JModCompat.java +++ b/src/main/java/dev/jab125/hotjoin/compat/legacy4j/Legacy4JModCompat.java @@ -67,7 +67,7 @@ public static void openLegacy4JUserPicker() { } public static void openLegacy4JUserPicker(Legacy4JData data) { - ScreenUtil.getLegacyOptions().selectedController().set(data.controllerIndex()); + if (data != null) ScreenUtil.getLegacyOptions().selectedController().set(data.controllerIndex()); ChooseUserScreen chooseUserScreen = new ChooseUserScreen(null); ((AuthCallback)chooseUserScreen).hotjoin$authResponse(s -> { Minecraft.getInstance().getToasts().addToast(new LegacyTip(Component.literal("Success, joining world..."))); @@ -156,7 +156,7 @@ public void onBeginScreenSet(Screen previousScreen, Screen newScreen) { if (newScreen instanceof ConfirmationScreen) { } else { - ScreenUtil.getLegacyOptions().selectedController().set(o.oldControllerIndex()); + if (o != null) ScreenUtil.getLegacyOptions().selectedController().set(o.oldControllerIndex()); } } }