Author: toad
Date: 2008-04-05 13:37:16 +0000 (Sat, 05 Apr 2008)
New Revision: 19022

Modified:
   trunk/freenet/src/freenet/clients/http/StartupToadlet.java
Log:
Fix NPE, patch from Daniel Cheng.

Modified: trunk/freenet/src/freenet/clients/http/StartupToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StartupToadlet.java  2008-04-05 
13:33:09 UTC (rev 19021)
+++ trunk/freenet/src/freenet/clients/http/StartupToadlet.java  2008-04-05 
13:37:16 UTC (rev 19022)
@@ -1,6 +1,3 @@
-/**
- * 
- */
 package freenet.clients.http;

 import java.io.IOException;
@@ -9,12 +6,16 @@
 import freenet.support.HTMLNode;
 import freenet.support.api.HTTPRequest;

+/**
+ * Toadlet for "Freenet is starting up" page.
+ */
 class StartupToadlet extends Toadlet {
+
+    private StaticToadlet staticToadlet;

-       private StaticToadlet staticToadlet;
-       
        public StartupToadlet(StaticToadlet staticToadlet) {
                super(null);
+               this.staticToadlet = staticToadlet;
        }

     public void handleGet(URI uri, HTTPRequest req, ToadletContext ctx) throws 
ToadletContextClosedException, IOException, RedirectException {
@@ -22,7 +23,7 @@
     ctx.forceDisconnect();

         String path = uri.getPath();
-        if(path.startsWith(StaticToadlet.ROOT_URL)) {
+        if (path.startsWith(StaticToadlet.ROOT_URL) && staticToadlet != null) {
             staticToadlet.handleGet(uri, req, ctx);
         } else {
             String desc = "Freenet is starting up";


Reply via email to