From 66da77ec41e3bf3918a38395577de38b5f57381f Mon Sep 17 00:00:00 2001 From: Fedor Date: Thu, 7 May 2020 14:45:34 +0300 Subject: [PATCH] Perform validity check before trying to use the content. --- editor/libeditor/HTMLStyleEditor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/libeditor/HTMLStyleEditor.cpp b/editor/libeditor/HTMLStyleEditor.cpp index bc7141ad3..6a1ffe8b4 100644 --- a/editor/libeditor/HTMLStyleEditor.cpp +++ b/editor/libeditor/HTMLStyleEditor.cpp @@ -333,8 +333,9 @@ HTMLEditor::SetInlinePropertyOnTextNode(Text& aText, RefPtr text = &aText; if (uint32_t(aEndOffset) != aText.Length()) { // 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()); + text = textNode->GetAsText(); } if (aStartOffset) {