Author: toad
Date: 2008-01-31 20:14:36 +0000 (Thu, 31 Jan 2008)
New Revision: 17441

Modified:
   trunk/freenet/src/freenet/node/ResettingHTLProbeRequestSender.java
Log:
It's optional here

Modified: trunk/freenet/src/freenet/node/ResettingHTLProbeRequestSender.java
===================================================================
--- trunk/freenet/src/freenet/node/ResettingHTLProbeRequestSender.java  
2008-01-31 20:13:24 UTC (rev 17440)
+++ trunk/freenet/src/freenet/node/ResettingHTLProbeRequestSender.java  
2008-01-31 20:14:36 UTC (rev 17441)
@@ -288,11 +288,13 @@
                                        // Count the nodes involved for results 
purposes.
                                        // Don't use the HTL or nearestLoc.
                        Message sub = 
msg.getSubMessage(DMT.FNPRHReturnSubMessage);
-                       double newBest = sub.getDouble(DMT.BEST_LOCATION);
-                       if(Location.distance(newBest, target, true) < 
Location.distance(best, target, true))
-                               best = newBest;
-                       counter += Math.max(0, msg.getShort(DMT.COUNTER));
-                       uniqueCounter += Math.max(0, 
msg.getShort(DMT.UNIQUE_COUNTER));
+                       if(sub != null) {
+                               double newBest = 
sub.getDouble(DMT.BEST_LOCATION);
+                               if(Location.distance(newBest, target, true) < 
Location.distance(best, target, true))
+                                       best = newBest;
+                               counter += Math.max(0, 
msg.getShort(DMT.COUNTER));
+                               uniqueCounter += Math.max(0, 
msg.getShort(DMT.UNIQUE_COUNTER));
+                       }
                                        if (msg.getBoolean(DMT.IS_LOCAL)) {
                                                //NB: IS_LOCAL means it's 
terminal. not(IS_LOCAL) implies that the rejection message was forwarded from a 
downstream node.
                                                //"Local" from our peers 
perspective, this has nothing to do with local requests (source==null)


Reply via email to