Skip to content

Commit 34774f2

Browse files
committed
jooby run: throws nullpointerexception when application fails to start fix #948
1 parent 87e5d69 commit 34774f2

File tree

1 file changed

+9
-7
lines changed
  • modules/jooby-run/src/main/java/org/jooby/run

1 file changed

+9
-7
lines changed

modules/jooby-run/src/main/java/org/jooby/run/Main.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -441,13 +441,15 @@ private void startApp(final List<String> args) {
441441
Field reffld = appref.getDeclaredField("ref");
442442
AtomicReference ref = (AtomicReference) reffld.get(null);
443443
this.app = ref.get();
444-
Method started = app.getClass().getMethod("isStarted");
445-
Boolean success = (Boolean) started.invoke(this.app);
446-
if (success) {
447-
debug("started: %s", alias);
448-
} else {
449-
debug("not started: %s", alias);
450-
System.exit(1);
444+
if (this.app != null) {
445+
Method started = app.getClass().getMethod("isStarted");
446+
Boolean success = (Boolean) started.invoke(this.app);
447+
if (success) {
448+
debug("started: %s", alias);
449+
} else {
450+
debug("not started: %s", alias);
451+
System.exit(1);
452+
}
451453
}
452454
} catch (Throwable ex) {
453455
Throwable cause = ex;

0 commit comments

Comments
 (0)