From a27e0ca555a45eefefc55c30a7dc84cca4e05c92 Mon Sep 17 00:00:00 2001 From: PaulStets Date: Sat, 14 Apr 2018 14:05:58 +0300 Subject: [PATCH] Added a small improvement to url parsing --- .../net/osmand/plus/wikivoyage/data/CustomWebViewClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/CustomWebViewClient.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/CustomWebViewClient.java index ea2325605e..e26bf7cf53 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/CustomWebViewClient.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/CustomWebViewClient.java @@ -40,7 +40,7 @@ public class CustomWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.contains(WEB_DOMAIN)) { - String lang = url.substring(url.indexOf(PAGE_PREFIX) + PAGE_PREFIX.length(), url.indexOf(".")); + String lang = url.substring(url.startsWith(PAGE_PREFIX) ? PAGE_PREFIX.length() : 0, url.indexOf(".")); String articleName = url.replace(PAGE_PREFIX + lang + WEB_DOMAIN, "") .replaceAll("_", " "); try {