Merge "Catch OperationUnsupportedException when linkifying using WebView" into klp-modular-dev
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user