summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2014-12-11 14:27:57 +0000
committerBen Murdoch <benm@google.com>2014-12-11 14:27:57 +0000
commit2b1bde299d96e9b244f578b176a4fc43c99c027c (patch)
tree580dfb7f0246942bdfcb7757175a6367f873628d
parentfe15d2a0bf7b10a21a53a4e286f6bad5ccbce7d3 (diff)
downloadBrowser-2b1bde299d96e9b244f578b176a4fc43c99c027c.tar.gz
Log an error when no activity is found to handle a URL.
Rather than crashing due to ActivityNotFoundException. Bug: 13930087 Change-Id: Id3af8301bb87298b885a24f70bf184abe4fc2a11
-rw-r--r--src/com/android/browser/UrlHandler.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/com/android/browser/UrlHandler.java b/src/com/android/browser/UrlHandler.java
index e21e3e87..edafebd1 100644
--- a/src/com/android/browser/UrlHandler.java
+++ b/src/com/android/browser/UrlHandler.java
@@ -144,14 +144,19 @@ public class UrlHandler {
intent = new Intent(Intent.ACTION_VIEW, Uri
.parse("market://search?q=pname:" + packagename));
intent.addCategory(Intent.CATEGORY_BROWSABLE);
- mActivity.startActivity(intent);
- // before leaving BrowserActivity, close the empty child tab.
- // If a new tab is created through JavaScript open to load this
- // url, we would like to close it as we will load this url in a
- // different Activity.
- mController.closeEmptyTab();
- return true;
- } else {
+ try {
+ mActivity.startActivity(intent);
+ // before leaving BrowserActivity, close the empty child tab.
+ // If a new tab is created through JavaScript open to load this
+ // url, we would like to close it as we will load this url in a
+ // different Activity.
+ mController.closeEmptyTab();
+ return true;
+ } catch (ActivityNotFoundException e) {
+ Log.w("Browser", "No activity found to handle " + url);
+ return false;
+ }
+ } else {
return false;
}
}