Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Fix NPE in Switchboard . getURL https://github.com/yacy/yacy_search_server/issues/441

reger246a1e259fd09f
diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java
index 3cea8164e..f00fc503e 100644
--- a/source/net/yacy/search/Switchboard.java
+++ b/source/net/yacy/search/Switchboard.java
@@ -1926,7 +1926,10 @@ public final class Switchboard extends serverSwitch {
if (urlhash.length == 0) return null;
final String url = this.index.fulltext().getURL(ASCII.String(urlhash));
if (url != null) return url;
- return this.crawlQueues.getURL(urlhash).toNormalform(true);
+ final DigestURL returl = this.crawlQueues.getURL(urlhash); // getURL may be null
+ if (returl != null)
+ return returl.toNormalform(true);
+ return null;
}
public String getURL(final String urlhash) throws IOException {
@@ -1934,7 +1937,10 @@ public final class Switchboard extends serverSwitch {
if (urlhash.length() == 0) return null;
final String url = this.index.fulltext().getURL(urlhash);
if (url != null) return url;
- return this.crawlQueues.getURL(urlhash.getBytes()).toNormalform(true);
+ final DigestURL returl = this.crawlQueues.getURL(urlhash.getBytes()); // getURL may be null
+ if (returl != null)
+ return returl.toNormalform(true);
+ return null;
}
public RankingProfile getRanking() {