From 4fb6de1ca762f9a6aa7aaabd99ffa8e7b39fd68e Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 11 Jun 2024 15:00:06 +0300 Subject: [PATCH] Fix NPE when QUARKUS_INIT_AND_EXIT is used Fixes: #41113 --- .../java/io/quarkus/runtime/shutdown/ShutdownRecorder.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/runtime/src/main/java/io/quarkus/runtime/shutdown/ShutdownRecorder.java b/core/runtime/src/main/java/io/quarkus/runtime/shutdown/ShutdownRecorder.java index ace0f19deb298..6c969598473b7 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/shutdown/ShutdownRecorder.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/shutdown/ShutdownRecorder.java @@ -28,6 +28,9 @@ public void setListeners(List listeners, boolean delayEnabled) } public static void runShutdown() { + if (shutdownListeners == null) { // when QUARKUS_INIT_AND_EXIT is used, ShutdownRecorder#setListeners has not been called + return; + } log.debug("Attempting to gracefully shutdown."); try { executePreShutdown();