From d547c3b4bd3e2a44f62b5241f5d0866d28815bab Mon Sep 17 00:00:00 2001 From: hermens Date: Sat, 29 Sep 2007 11:18:09 +0000 Subject: [PATCH] Avoid NullPointerException in yacySeedDB.lookupByIP git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4116 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/yacy/yacySeedDB.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.java index 54de56870..8af3807e6 100644 --- a/source/de/anomic/yacy/yacySeedDB.java +++ b/source/de/anomic/yacy/yacySeedDB.java @@ -639,6 +639,10 @@ public final class yacySeedDB { seed = (yacySeed) e.nextElement(); if (seed != null) { addressStr = seed.getPublicAddress(); + if (addressStr == null) { + serverLog.logWarning("YACY","lookupByIP: address of seed " + seed.getName() + " is null."); + continue; + } if ((pos = addressStr.indexOf(":"))!= -1) { addressStr = addressStr.substring(0,pos); } @@ -672,6 +676,7 @@ public final class yacySeedDB { try { // check local seed addressStr = mySeed.getPublicAddress(); + if (addressStr == null) return null; if ((pos = addressStr.indexOf(":"))!= -1) { addressStr = addressStr.substring(0,pos); }