Skip to content

Commit 87f10dc

Browse files
committed
refactor: Prevent NullPointerException mode adjustment
1 parent b2f4d15 commit 87f10dc

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main/java/cn/msdnicrosoft/commandbuttons/gui/ButtonGUI.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ public ButtonGUI() {
3636
private void addCloseButton(WGridPanel root) {
3737
WButton escButton = new WButton(Component.literal("X"));
3838
escButton.setOnClick(() -> {
39-
assert Minecraft.getInstance().player != null;
39+
if (Minecraft.getInstance().player == null) {
40+
return;
41+
}
4042
Minecraft.getInstance().player.clientSideCloseContainer();
4143
});
4244
root.add(escButton, 17, 1, 2, 2);

0 commit comments

Comments
 (0)