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
--- 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);