From 895e87c2a3547604763e069d66bb2989c16755f5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 5 Feb 2016 19:05:50 +0300 Subject: [PATCH] openUri: do not crash if something went wrong --- .../java/org/fox/ttrss/CommonActivity.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java index a8536555..65c97d10 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java @@ -309,7 +309,12 @@ public class CommonActivity extends ActionBarActivity implements SharedPreferenc CustomTabsIntent intent = builder.build(); - intent.launchUrl(this, uri); + try { + intent.launchUrl(this, uri); + } catch (Exception e) { + e.printStackTrace(); + toast(e.getMessage()); + } } } @@ -358,7 +363,12 @@ public class CommonActivity extends ActionBarActivity implements SharedPreferenc Intent intent = new Intent(Intent.ACTION_VIEW, uri); - startActivity(intent); + try { + startActivity(intent); + } catch (Exception e) { + e.printStackTrace(); + toast(e.getMessage()); + } } }); @@ -386,7 +396,11 @@ public class CommonActivity extends ActionBarActivity implements SharedPreferenc } else { Intent intent = new Intent(Intent.ACTION_VIEW, uri); - startActivity(intent); + try { + startActivity(intent); + } catch (Exception e) { + toast(e.getMessage()); + } } }