Avoid NullPointerException in yacySeedDB.lookupByIP

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4116 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
hermens 18 years ago
parent 5b1a937ed8
commit d547c3b4bd

@ -639,6 +639,10 @@ public final class yacySeedDB {
seed = (yacySeed) e.nextElement(); seed = (yacySeed) e.nextElement();
if (seed != null) { if (seed != null) {
addressStr = seed.getPublicAddress(); addressStr = seed.getPublicAddress();
if (addressStr == null) {
serverLog.logWarning("YACY","lookupByIP: address of seed " + seed.getName() + " is null.");
continue;
}
if ((pos = addressStr.indexOf(":"))!= -1) { if ((pos = addressStr.indexOf(":"))!= -1) {
addressStr = addressStr.substring(0,pos); addressStr = addressStr.substring(0,pos);
} }
@ -672,6 +676,7 @@ public final class yacySeedDB {
try { try {
// check local seed // check local seed
addressStr = mySeed.getPublicAddress(); addressStr = mySeed.getPublicAddress();
if (addressStr == null) return null;
if ((pos = addressStr.indexOf(":"))!= -1) { if ((pos = addressStr.indexOf(":"))!= -1) {
addressStr = addressStr.substring(0,pos); addressStr = addressStr.substring(0,pos);
} }

Loading…
Cancel
Save