on develop help sign in
Don't crash if URI cannot be handled by Android.

Instead the request is simply ignored, which is not ideal, but definitely better than a crash. This affects application uris like whatsapp:// - if WhatsApp was not installed, the application would crash on such an URI.

commit46371fca6499c9a882c9227a42ab6fd0e5de947c authorRobert Klotzner <robert.klotzner@gmx.at> dateThu 22 Mar 2018, 15:28 (9 years ago) parentdf9fff3
1 file changed+6−1
reflex-dom/java/org/reflexfrp/reflexdom/MainWidget.java+6−1
reflex-dom/java/org/reflexfrp/reflexdom/MainWidget.java+6−1
@@ -79,7 +79,12 @@ public class MainWidget {
7979 @Override
8080 public boolean shouldOverrideUrlLoading(WebView view, String url) {
8181 if( url != null && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("file://")) {
82− view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
82+ try {
83+ view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
84+ }
85+ catch(Exception e) {
86+ Log.e("reflex", "Starting activity for intent '" + url + "' failed!");
87+ }
8388 return true;
8489 } else {
8590 return false;