Bug 1509989 - Remove a useless null-check. r=mats
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 27 Nov 2018 16:54:57 +0000
changeset 448356 76cda4d85a5a55f75afdd932b782ab02d01b6d5d
parent 448355 ab61114ae332c44234176d2181a897ff5e89d6d6
child 448357 d73fbe0676946487d3f7e2e3d61b7938dc50733d
push id73815
push userealvarez@mozilla.com
push dateTue, 27 Nov 2018 18:03:28 +0000
treeherderautoland@49adeee1a194 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1509989
milestone65.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 1509989 - Remove a useless null-check. r=mats If startTextNode is null we unconditionally dereference tStartContainer. Depends on D13069 Differential Revision: https://phabricator.services.mozilla.com/D13070
dom/base/nsRange.cpp
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -2628,18 +2628,17 @@ nsRange::InsertNode(nsINode& aNode, Erro
     aRv.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
     return;
   }
 
   // This is the node we'll be inserting before, and its parent
   nsCOMPtr<nsINode> referenceNode;
   nsCOMPtr<nsINode> referenceParentNode = tStartContainer;
 
-  RefPtr<Text> startTextNode =
-    tStartContainer ? tStartContainer->GetAsText() : nullptr;
+  RefPtr<Text> startTextNode = tStartContainer->GetAsText();
   nsCOMPtr<nsINodeList> tChildList;
   if (startTextNode) {
     referenceParentNode = tStartContainer->GetParentNode();
     if (!referenceParentNode) {
       aRv.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
       return;
     }