diff options
-rw-r--r-- | app/src/main/java/org/traccar/manager/MainFragment.java | 3 | ||||
-rw-r--r-- | app/src/main/java/org/traccar/manager/StartFragment.java | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/app/src/main/java/org/traccar/manager/MainFragment.java b/app/src/main/java/org/traccar/manager/MainFragment.java index d63c19e..3f38bbb 100644 --- a/app/src/main/java/org/traccar/manager/MainFragment.java +++ b/app/src/main/java/org/traccar/manager/MainFragment.java @@ -109,7 +109,8 @@ public class MainFragment extends WebViewFragment { @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { Uri uri = Uri.parse(url); - if (uri.getHost().equals("cdnjs.cloudflare.com")) { + String host = uri.getHost(); + if (host != null && host.equals("cdnjs.cloudflare.com")) { String path = uri.getPath().substring("/ajax/libs".length()); try { return loadFileFromAssets(url, "cdnjs" + path); diff --git a/app/src/main/java/org/traccar/manager/StartFragment.java b/app/src/main/java/org/traccar/manager/StartFragment.java index 429e8d1..f56d7e8 100644 --- a/app/src/main/java/org/traccar/manager/StartFragment.java +++ b/app/src/main/java/org/traccar/manager/StartFragment.java @@ -64,7 +64,7 @@ public class StartFragment extends Fragment implements View.OnClickListener { protected Boolean doInBackground(String... urls) { try { - Uri uri = Uri.parse(urls[0]).buildUpon().appendPath("api/server").build(); + Uri uri = Uri.parse(urls[0]).buildUpon().appendEncodedPath("api/server").build(); URL url = new URL(uri.toString()); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); |