diff --git a/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java index bc57782191e2e..33d17d3d78fe3 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java @@ -452,13 +452,15 @@ public void run() { } //take a reliable reference before changing the application state: final Application app = currentApplication; - if (app.isStarted()) { - // On CLI apps, SIGINT won't call io.quarkus.runtime.Application#stop(), - // making the awaitShutdown() below block the application termination process - // It should be a noop if called twice anyway - app.stop(); + if (app != null) { + if (app.isStarted()) { + // On CLI apps, SIGINT won't call io.quarkus.runtime.Application#stop(), + // making the awaitShutdown() below block the application termination process + // It should be a noop if called twice anyway + app.stop(); + } + app.awaitShutdown(); } - app.awaitShutdown(); currentApplication = null; System.out.flush(); System.err.flush();