Bug 1478605 - HTMLEditRules::SplitMailCites() should check if split left node has a primary frame before accessing it r?jorgk draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 26 Jul 2018 19:38:33 +0900
changeset 822917 624080453c6685bce9ba7391b5f6140ed586ae2e
parent 822916 7b8bf8f75181e4a737bae7e68e9258085d1b1810
push id117520
push usermasayuki@d-toybox.com
push dateThu, 26 Jul 2018 10:40:29 +0000
reviewersjorgk
bugs1478605
milestone63.0a1
Bug 1478605 - HTMLEditRules::SplitMailCites() should check if split left node has a primary frame before accessing it r?jorgk The crash at this point may be caused by unexpected behavior change. However, it's difficult to investigate what causes the crash. So, let's just avoid the crash to investigate what unexpected behavior occurs. MozReview-Commit-ID: P6YZTqP7zI
editor/libeditor/HTMLEditRules.cpp
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -2177,16 +2177,17 @@ HTMLEditRules::SplitMailCites(bool* aHan
   // that the serializer will insert a break where the user saw one.
   // FYI: splitCiteNodeResult grabs the previous node with nsCOMPtr.  So, it's
   //      safe to access previousNodeOfSplitPoint even after changing the DOM
   //      tree and/or selection even though it's raw pointer.
   nsIContent* previousNodeOfSplitPoint =
     splitCiteNodeResult.GetPreviousNode();
   if (previousNodeOfSplitPoint &&
       previousNodeOfSplitPoint->IsHTMLElement(nsGkAtoms::span) &&
+      previousNodeOfSplitPoint->GetPrimaryFrame() &&
       previousNodeOfSplitPoint->GetPrimaryFrame()->
                                   IsFrameOfType(nsIFrame::eBlockFrame)) {
     nsCOMPtr<nsINode> lastChild =
       previousNodeOfSplitPoint->GetLastChild();
     if (lastChild && !lastChild->IsHTMLElement(nsGkAtoms::br)) {
       // We ignore the result here.
       EditorRawDOMPoint endOfPreviousNodeOfSplitPoint;
       endOfPreviousNodeOfSplitPoint.SetToEndOf(previousNodeOfSplitPoint);