Author: toad
Date: 2007-06-29 18:07:06 +0000 (Fri, 29 Jun 2007)
New Revision: 13826

Modified:
   trunk/freenet/src/freenet/node/Node.java
Log:
Fix NPE shutting down opennet

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2007-06-29 18:02:53 UTC (rev 
13825)
+++ trunk/freenet/src/freenet/node/Node.java    2007-06-29 18:07:06 UTC (rev 
13826)
@@ -778,20 +778,22 @@
                                }
                        }
                        public void set(boolean val) throws 
InvalidConfigValueException {
+                               OpennetManager o;
                                synchronized(Node.this) {
                                        if(val == (opennet != null)) return;
                                        if(val) {
                                                try {
-                                                       opennet = new 
OpennetManager(Node.this, opennetCryptoConfig);
+                                                       o = opennet = new 
OpennetManager(Node.this, opennetCryptoConfig);
                                                } catch (NodeInitException e) {
                                                        throw new 
InvalidConfigValueException(e.getMessage());
                                                }
                                        } else {
+                                               o = opennet;
                                                opennet = null;
                                        }
                                }
-                               if(val) opennet.start();
-                               else opennet.stop();
+                               if(val) o.start();
+                               else o.stop();
                        }
                });



Reply via email to