From e4548d6ad725e7affc01cb7e8a77b34dd053a067 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 13 Apr 2020 12:55:47 +0200 Subject: Issue #1513 - Bail on orphan node This was refactored by Mozilla into doing effectively the same thing so it aligns with them re: behavior. Resolves #1513 --- editor/libeditor/HTMLEditRules.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'editor') 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 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! -- cgit v1.2.3