fix for npe

pull/32/head
Michael Peter Christen 9 years ago
parent 0347bfa71f
commit ef8cd80593

@ -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 {

Loading…
Cancel
Save