Added fail-save

pull/213/head
M66B 2 years ago
parent ae09857097
commit f17b715257

@ -1530,7 +1530,8 @@ public class HtmlHelper {
}
Matcher matcher = pattern.matcher(text);
if (matcher.find()) {
if (matcher.find())
try {
Element span = document.createElement("span");
int pos = 0;
@ -1548,6 +1549,12 @@ public class HtmlHelper {
String group = matcher.group();
int start = matcher.start();
int end = matcher.end();
if (start < pos || start > end) {
Log.e("Autolink pos=" + pos +
" start=" + start + " end=" + end +
" len=" + group.length() + "/" + text.length());
return;
}
// Workarounds
if (group.endsWith(".")) {
@ -1605,6 +1612,8 @@ public class HtmlHelper {
tnode.before(span);
tnode.text("");
} catch (Throwable ex) {
Log.e(ex);
}
}
}

Loading…
Cancel
Save