Bug 1425091 - Part 1. Should check whether CreateNode is failure. r?masayuki
This crash occurs when CreateNode returns nullptr that is error. So we should
check whether this method is failure.
MozReview-Commit-ID: 9jDOnEYSurG
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -3729,16 +3729,19 @@ HTMLEditRules::WillMakeList(Selection* a
if (!curList) {
SplitNodeResult splitCurNodeResult =
MaybeSplitAncestorsForInsert(listType, atCurNode);
if (NS_WARN_IF(splitCurNodeResult.Failed())) {
return splitCurNodeResult.Rv();
}
curList =
htmlEditor->CreateNode(listType, splitCurNodeResult.SplitPoint());
+ if (NS_WARN_IF(!curList)) {
+ return NS_ERROR_FAILURE;
+ }
// remember our new block for postprocessing
mNewBlock = curList;
// curList is now the correct thing to put curNode in
prevListItem = nullptr;
// atCurNode is now referring the right node with mOffset but
// referring the left node with mRef. So, invalidate it now.
atCurNode.Clear();