summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-04-13 12:55:47 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 13:28:10 +0200
commit9f5529d1e7374ee3ed186958c8cf192e88b7405d (patch)
tree0e0fadca02545250b96adb4b220dffaff3333829 /editor
parent26c888208a11c3e9159fd5c7755abb8a34aeda39 (diff)
downloadUXP-9f5529d1e7374ee3ed186958c8cf192e88b7405d.tar
UXP-9f5529d1e7374ee3ed186958c8cf192e88b7405d.tar.gz
UXP-9f5529d1e7374ee3ed186958c8cf192e88b7405d.tar.lz
UXP-9f5529d1e7374ee3ed186958c8cf192e88b7405d.tar.xz
UXP-9f5529d1e7374ee3ed186958c8cf192e88b7405d.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')
-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!