diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-13 12:55:47 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-13 12:55:47 +0200 |
commit | e4548d6ad725e7affc01cb7e8a77b34dd053a067 (patch) | |
tree | 9a899d2096fc6578cb9904d4217218dd4689f0f9 /editor/libeditor | |
parent | a2bc0e0ec6da3a689fa08cb02a9d65889de60f7c (diff) | |
download | UXP-e4548d6ad725e7affc01cb7e8a77b34dd053a067.tar UXP-e4548d6ad725e7affc01cb7e8a77b34dd053a067.tar.gz UXP-e4548d6ad725e7affc01cb7e8a77b34dd053a067.tar.lz UXP-e4548d6ad725e7affc01cb7e8a77b34dd053a067.tar.xz UXP-e4548d6ad725e7affc01cb7e8a77b34dd053a067.zip |
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
Diffstat (limited to 'editor/libeditor')
-rw-r--r-- | editor/libeditor/HTMLEditRules.cpp | 6 |
1 files changed, 5 insertions, 1 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! |