From e990297d2e61958ba2e1b4364bf32f1228a8eef4 Mon Sep 17 00:00:00 2001 From: reger Date: Thu, 15 Sep 2016 23:26:25 +0200 Subject: [PATCH] avoid NPE on hello message with missing "yourip" key http://mantis.tokeek.de/view.php?id=684 --- source/net/yacy/peers/Protocol.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java index 1acfef42a..01938443e 100644 --- a/source/net/yacy/peers/Protocol.java +++ b/source/net/yacy/peers/Protocol.java @@ -259,6 +259,10 @@ public final class Protocol { mySeed.setIPs(Switchboard.getSwitchboard().myPublicIPs()); } else { final String myIP = result.get("yourip"); + if (myIP == null) { + Network.log.info("yacyClient.hello result error: Peer sent incompleet hello message (key yourip is missing)"); + return null; // no success + } // with the IPv6 extension, this may contain several ips, separated by comma ',' HashSet h = new HashSet<>(); for (String s: CommonPattern.COMMA.split(myIP)) {