Don't throw NPEs when executing the calculator demo
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 27 Dec 2012 19:50:16 +0100
changeset 389f69966d2e6cb
parent 388 e1f64baf73b9
child 390 40fabaeca68d
Don't throw NPEs when executing the calculator demo
launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java
     1.1 --- a/launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java	Thu Dec 27 19:39:58 2012 +0100
     1.2 +++ b/launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java	Thu Dec 27 19:50:16 2012 +0100
     1.3 @@ -188,7 +188,7 @@
     1.4          for (;;) {
     1.5              int prev = methods.size();
     1.6              try {
     1.7 -                if (wait.await(timeOut, TimeUnit.MILLISECONDS)) {
     1.8 +                if (wait != null && wait.await(timeOut, TimeUnit.MILLISECONDS)) {
     1.9                      break;
    1.10                  }
    1.11              } catch (InterruptedException ex) {
    1.12 @@ -275,6 +275,9 @@
    1.13      }
    1.14      
    1.15      private void stopServerAndBrwsr(HttpServer server, Object[] brwsr) throws IOException {
    1.16 +        if (brwsr == null) {
    1.17 +            return;
    1.18 +        }
    1.19          Process process = (Process)brwsr[0];
    1.20          
    1.21          server.stop();