mirror of https://github.com/M66B/FairEmail.git
Prevent crash
This commit is contained in:
parent
8a377e451f
commit
440cac41e8
|
@ -226,7 +226,8 @@ public class HtmlHelper {
|
||||||
// Split parent link and linked image
|
// Split parent link and linked image
|
||||||
boolean linked = false;
|
boolean linked = false;
|
||||||
for (Element parent : img.parents())
|
for (Element parent : img.parents())
|
||||||
if ("a".equals(parent.tagName()) && !TextUtils.isEmpty(parent.attr("href"))) {
|
if ("a".equals(parent.tagName()) &&
|
||||||
|
!TextUtils.isEmpty(parent.attr("href"))) {
|
||||||
String text = parent.attr("title").trim();
|
String text = parent.attr("title").trim();
|
||||||
if (TextUtils.isEmpty(text))
|
if (TextUtils.isEmpty(text))
|
||||||
text = parent.attr("alt").trim();
|
text = parent.attr("alt").trim();
|
||||||
|
@ -235,18 +236,20 @@ public class HtmlHelper {
|
||||||
|
|
||||||
img.remove();
|
img.remove();
|
||||||
parent.appendText(text);
|
parent.appendText(text);
|
||||||
|
String outer = parent.outerHtml();
|
||||||
|
|
||||||
|
parent.tagName("span");
|
||||||
|
parent.html(outer);
|
||||||
|
parent.appendChild(div);
|
||||||
|
|
||||||
Element span = document.createElement("span");
|
|
||||||
span.appendChild(parent.clone());
|
|
||||||
span.appendChild(div);
|
|
||||||
parent.replaceWith(span);
|
|
||||||
linked = true;
|
linked = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!linked)
|
if (!linked) {
|
||||||
img.replaceWith(div);
|
img.tagName("div");
|
||||||
|
img.html(div.html());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Autolink
|
// Autolink
|
||||||
|
|
Loading…
Reference in New Issue