Bug 1402196 - Part 1. Don't add null range to aArrayOfRanges. r=masayuki
☠☠ backed out by 51a6e6d8ce20 ☠ ☠
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Mon, 23 Oct 2017 12:22:45 +0900
changeset 685698 3aff5bcb58168c55c71957eac068d2176d1f24a3
parent 685697 be03517460fdd4a409ef6b01669f861a27aa1d3b
child 685699 10e5f407149df2d30dcea49cdd488d1b9a4a404f
push id86016
push userkgupta@mozilla.com
push dateWed, 25 Oct 2017 01:53:44 +0000
reviewersmasayuki
bugs1402196
milestone58.0a1
Bug 1402196 - Part 1. Don't add null range to aArrayOfRanges. r=masayuki RangeItem::GetRange can return null, so we shouldn't add null range to aArrayOfRanges. MozReview-Commit-ID: Ci5VHeqE8km
editor/libeditor/HTMLEditRules.cpp
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -5888,17 +5888,20 @@ HTMLEditRules::GetNodesForOperation(
       rv = BustUpInlinesAtRangeEndpoints(*item);
       if (NS_FAILED(rv)) {
         break;
       }
     }
     // Then unregister the ranges
     for (auto& item : rangeItemArray) {
       htmlEditor->mRangeUpdater.DropRangeItem(item);
-      aArrayOfRanges.AppendElement(item->GetRange());
+      RefPtr<nsRange> range = item->GetRange();
+      if (range) {
+        aArrayOfRanges.AppendElement(range);
+      }
     }
     NS_ENSURE_SUCCESS(rv, rv);
   }
   // Gather up a list of all the nodes
   for (auto& range : aArrayOfRanges) {
     DOMSubtreeIterator iter;
     nsresult rv = iter.Init(*range);
     NS_ENSURE_SUCCESS(rv, rv);