From 1ab0f1972271fb5d0b6188094249f45b4978e9d0 Mon Sep 17 00:00:00 2001 From: Gigabit101 Date: Thu, 5 Sep 2024 05:23:53 +0100 Subject: [PATCH] Fix null pointer when stopping chunk pregeneration (#1514) --- .../neoforged/neoforge/server/command/GenerateCommand.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/neoforged/neoforge/server/command/GenerateCommand.java b/src/main/java/net/neoforged/neoforge/server/command/GenerateCommand.java index a37a5732b1..d3ef9c3f80 100644 --- a/src/main/java/net/neoforged/neoforge/server/command/GenerateCommand.java +++ b/src/main/java/net/neoforged/neoforge/server/command/GenerateCommand.java @@ -96,8 +96,10 @@ private static int stopGeneration(CommandSourceStack source) { double percent = (double) count / total * 100.0; source.sendSuccess(() -> Component.translatable("commands.neoforge.chunkgen.stopped", count, total, percent), true); - generationBar.close(); - generationBar = null; + if (generationBar != null) { + generationBar.close(); + generationBar = null; + } activeTask = null; } else { source.sendSuccess(() -> Component.translatable("commands.neoforge.chunkgen.not_running"), false);