Bug 802995 - Missing null check in nsTextServicesDocument::DeleteSelection; r=ehsan a=lsblakk
authorAryeh Gregor <ayg@aryeh.name>
Thu, 25 Oct 2012 14:36:23 +0200
changeset 109689 a2cc1ba868179ec39e91b1ce4035437e6f2add66
parent 109688 8bd5b4da0d06303aac15d8d23543dc34e1d22ac1
child 109690 8c3b288ab1be6d111609008d66844718fa83e478
push id1615
push usereakhgari@mozilla.com
push dateFri, 26 Oct 2012 19:43:10 +0000
treeherdermozilla-beta@a2cc1ba86817 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, lsblakk
bugs802995
milestone17.0
Bug 802995 - Missing null check in nsTextServicesDocument::DeleteSelection; r=ehsan a=lsblakk
editor/txtsvc/src/nsTextServicesDocument.cpp
--- a/editor/txtsvc/src/nsTextServicesDocument.cpp
+++ b/editor/txtsvc/src/nsTextServicesDocument.cpp
@@ -1378,23 +1378,24 @@ nsTextServicesDocument::DeleteSelection(
 
     if (origStartNode != curStartNode || origEndNode != curEndNode)
     {
       // The range has changed, so we need to create a new content
       // iterator based on the new range.
 
       nsCOMPtr<nsIContent> curContent;
 
-      if (mIteratorStatus != nsTextServicesDocument::eIsDone &&
-          mIterator->GetCurrentNode()->IsContent()) {
+      if (mIteratorStatus != nsTextServicesDocument::eIsDone) {
         // The old iterator is still pointing to something valid,
         // so get its current node so we can restore it after we
         // create the new iterator!
 
-        curContent = mIterator->GetCurrentNode()->AsContent();
+        curContent = mIterator->GetCurrentNode()
+                     ? mIterator->GetCurrentNode()->AsContent()
+                     : nullptr;
       }
 
       // Create the new iterator.
 
       result = CreateContentIterator(mExtent, getter_AddRefs(mIterator));
 
       if (NS_FAILED(result))
       {