diff options
-rw-r--r-- | editor/libeditor/HTMLEditRules.cpp | 6 | ||||
-rw-r--r-- | editor/libeditor/HTMLStyleEditor.cpp | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/editor/libeditor/HTMLEditRules.cpp b/editor/libeditor/HTMLEditRules.cpp index c2d61f767..545e22f70 100644 --- a/editor/libeditor/HTMLEditRules.cpp +++ b/editor/libeditor/HTMLEditRules.cpp @@ -4641,7 +4641,11 @@ HTMLEditRules::WillAlign(Selection& aSelection, } nsCOMPtr<nsINode> curParent = curNode->GetParentNode(); - int32_t offset = curParent ? curParent->IndexOf(curNode) : -1; + if (!curParent) { + continue; + } + + int32_t offset = curParent->IndexOf(curNode); // Skip insignificant formatting text nodes to prevent unnecessary // structure splitting! 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> 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) { |