am 42c53fd6: Merge "Catch OperationUnsupportedException when linkifying using WebView" into klp-modular-dev

* commit '42c53fd64641d3c2974b3b8f25a2c600f4c4dd7d':
  Catch OperationUnsupportedException when linkifying using WebView
This commit is contained in:
Justin Koh
2014-06-10 18:35:20 +00:00
committed by Android Git Automerger

View File

@@ -465,6 +465,7 @@ public class Linkify {
String address; String address;
int base = 0; int base = 0;
try {
while ((address = WebView.findAddress(string)) != null) { while ((address = WebView.findAddress(string)) != null) {
int start = string.indexOf(address); int start = string.indexOf(address);
@@ -492,6 +493,12 @@ public class Linkify {
spec.url = "geo:0,0?q=" + encodedAddress; spec.url = "geo:0,0?q=" + encodedAddress;
links.add(spec); links.add(spec);
} }
} catch (UnsupportedOperationException e) {
// findAddress may fail with an unsupported exception on platforms without a WebView.
// In this case, we will not append anything to the links variable: it would have died
// in WebView.findAddress.
return;
}
} }
private static final void pruneOverlaps(ArrayList<LinkSpec> links) { private static final void pruneOverlaps(ArrayList<LinkSpec> links) {