Bug 1324505 - Part 1. Check whether parent node is null. r=masayuki
☠☠ backed out by ee2a1ad506f0 ☠ ☠
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 11 Jan 2017 19:03:41 +0900
changeset 374558 f1f0f69bc78f1f55d34caa1ac22527616bad06de
parent 374557 1498c78815dcf8db4ef883125ba6d1d5c19a7db6
child 374559 ea8744408e8904596bce5aeb207cec80c91de730
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1324505
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
editor/libeditor/HTMLEditRules.cpp
--- 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();