Bug 1324505 - Part 1. Check whether parent node is null. r?masayuki
designMode is too strange. Parent of common ancestor of selection might be nullptr, so we should check whether nullptr.
MozReview-Commit-ID: Cy1k2Mpkws0
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -7859,17 +7859,20 @@ HTMLEditRules::PopListItem(nsIDOMNode* a
nsCOMPtr<Element> listItem = do_QueryInterface(aListItem);
// check parms
NS_ENSURE_TRUE(listItem && aOutOfList, NS_ERROR_NULL_POINTER);
// init out params
*aOutOfList = false;
nsCOMPtr<nsINode> curParent = listItem->GetParentNode();
- int32_t offset = curParent ? curParent->IndexOf(listItem) : -1;
+ if (NS_WARN_IF(!curParent)) {
+ return NS_ERROR_FAILURE;
+ }
+ int32_t offset = curParent->IndexOf(listItem);
if (!HTMLEditUtils::IsListItem(listItem)) {
return NS_ERROR_FAILURE;
}
// if it's first or last list item, don't need to split the list
// otherwise we do.
nsCOMPtr<nsINode> curParPar = curParent->GetParentNode();