From ef8cd805938189ef6e2979fa47bd661d4f7af613 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Thu, 3 Dec 2015 00:33:13 +0100 Subject: [PATCH] fix for npe --- source/net/yacy/search/index/Segment.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/net/yacy/search/index/Segment.java b/source/net/yacy/search/index/Segment.java index d8683e356..2e68a7956 100644 --- a/source/net/yacy/search/index/Segment.java +++ b/source/net/yacy/search/index/Segment.java @@ -506,11 +506,13 @@ public class Segment { if (!language.equals(url.language())) { // see if we have a hint in the url that the statistic was right final String u = urlNormalform.toLowerCase(); - if (!u.contains("/" + language + "/") && !u.contains("/" + ISO639.country(language).toLowerCase() + "/")) { + String ISO639_country = ISO639.country(language); + if (u.contains("/" + language + "/") || + (ISO639_country != null && u.contains("/" + ISO639.country(language).toLowerCase() + "/"))) { + // this is a strong hint that the statistics was in fact correct + } else { // no confirmation using the url, use the TLD language = url.language(); - } else { - // this is a strong hint that the statistics was in fact correct } } } else {