Issue #1514 - Perform validity check before trying to use the content.

Resolves #1514
This commit is contained in:
wolfbeast 2020-04-13 12:57:07 +02:00 • committed by Roy Tam
commit de71a9e013

View file

@ -333,8 +333,9 @@ HTMLEditor::SetInlinePropertyOnTextNode(Text& aText,
RefPtr<Text> text = &aText; RefPtr<Text> text = &aText;
if (uint32_t(aEndOffset) != aText.Length()) { if (uint32_t(aEndOffset) != aText.Length()) {
// We need to split off back of text node // We need to split off back of text node
text = SplitNode(aText, aEndOffset, rv)->GetAsText(); nsIContent* textNode = SplitNode(aText, aEndOffset, rv);
NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult()); NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
text = textNode->GetAsText();
} }
if (aStartOffset) { if (aStartOffset) {