Author: toad
Date: 2007-08-08 20:25:26 +0000 (Wed, 08 Aug 2007)
New Revision: 14539

Modified:
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
Log:
Prevent NPE, related to earlier NPE fix

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2007-08-08 20:03:14 UTC (rev 14538)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2007-08-08 20:25:26 UTC (rev 14539)
@@ -324,7 +324,8 @@
                if(logMINOR) Logger.minor(this, "Permanently failed block: 
"+blockNo+" on "+this+" : "+e, e);
                boolean allFailed;
                // Since we can't keep the key, we need to unregister for it at 
this point to avoid a memory leak
-               seg.unregisterKey(getBlockNodeKey(blockNo));
+               NodeCHK key = getBlockNodeKey(blockNo);
+               if(key != null) seg.unregisterKey(key);
                synchronized(this) {
                        if(isFinishing()) return; // this failure is now 
irrelevant, and cleanup will occur on the decoder thread
                        if(blockNo < dataKeys.length) {


Reply via email to