Bug 802995 - Missing null check in nsTextServicesDocument::DeleteSelection; r=ehsan
authorAryeh Gregor <ayg@aryeh.name>
Thu, 25 Oct 2012 14:36:23 +0200
changeset 111405 9a9ae8ce3b8dfed7e013155cab96fe7a02e7b7c1
parent 111404 b011b2c888d14956b1d923b231c51c8371b1091a
child 111406 15c00f89393920d668b1038a4f59c753cd33061a
push id23747
push userryanvm@gmail.com
push dateFri, 26 Oct 2012 01:15:16 +0000
treeherdermozilla-central@5ecff3e46ed5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs802995
milestone19.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 802995 - Missing null check in nsTextServicesDocument::DeleteSelection; r=ehsan
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))
       {