Skip to content

Commit

Permalink
Avoid NullPointerExceptions when application fails to start
Browse files Browse the repository at this point in the history
  • Loading branch information
zakkak committed Aug 27, 2024
1 parent fae59c9 commit 80bf54c
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 80bf54c

Please sign in to comment.