mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-24 08:04:11 +08:00
fix(quoted-text): Guard call to children[0] Sentry 33642
This commit is contained in:
parent
14acad2197
commit
4962d24b4d
1 changed files with 5 additions and 0 deletions
|
@ -52,6 +52,8 @@ class QuotedHTMLTransformer
|
||||||
|
|
||||||
@removeTrailingBr(doc)
|
@removeTrailingBr(doc)
|
||||||
DOMUtils.Mutating.removeElements(quoteStringDetector(doc))
|
DOMUtils.Mutating.removeElements(quoteStringDetector(doc))
|
||||||
|
|
||||||
|
return "<head></head><body></body>" unless doc.children[0]
|
||||||
return doc.children[0].innerHTML
|
return doc.children[0].innerHTML
|
||||||
|
|
||||||
# Finds any trailing BR tags and removes them in place
|
# Finds any trailing BR tags and removes them in place
|
||||||
|
@ -88,6 +90,9 @@ class QuotedHTMLTransformer
|
||||||
text = "HTML Parser Error: #{error.toString()}"
|
text = "HTML Parser Error: #{error.toString()}"
|
||||||
doc = domParser.parseFromString(text, "text/html")
|
doc = domParser.parseFromString(text, "text/html")
|
||||||
NylasEnv.reportError(error)
|
NylasEnv.reportError(error)
|
||||||
|
|
||||||
|
# As far as we can tell, when this succeeds, doc /always/ has at least
|
||||||
|
# one child: an <html> node.
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
_wholeBodyIsQuote: (doc, quoteElements) ->
|
_wholeBodyIsQuote: (doc, quoteElements) ->
|
||||||
|
|
Loading…
Reference in a new issue