summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-04-13 12:55:47 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-13 12:55:47 +0200
commite4548d6ad725e7affc01cb7e8a77b34dd053a067 (patch)
tree9a899d2096fc6578cb9904d4217218dd4689f0f9
parenta2bc0e0ec6da3a689fa08cb02a9d65889de60f7c (diff)
downloadUXP-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
-rw-r--r--editor/libeditor/HTMLEditRules.cpp6
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!