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 357582 f1f0f69bc78f1f55d34caa1ac22527616bad06de
parent 357581 1498c78815dcf8db4ef883125ba6d1d5c19a7db6
child 357583 ea8744408e8904596bce5aeb207cec80c91de730
push id10621
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 16:02:43 +0000
treeherdermozilla-aurora@dca7b42e6c67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1324505
milestone53.0a1
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();