Skip to content

Commit

Permalink
Merge pull request quarkusio#42794 from zakkak/2024-08-27-fix-NPE
Browse files Browse the repository at this point in the history
Avoid `NullPointerException`s when application fails to start
  • Loading branch information
gsmet authored Aug 27, 2024
2 parents 6a41ad8 + 80bf54c commit b7a4302
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 b7a4302

Please sign in to comment.