Bug 888602 - Add null-check in mozInlineSpellChecker::ReplaceWord. r=ehsan
authorAndrew Quartey <andrew.quartey@gmail.com>
Wed, 07 Aug 2013 20:31:38 -0400
changeset 141750 2c831784b8f8bb227736b87b606b6a09308e133f
parent 141749 e4dfd9facfbdf1378bf4b4f6e36db5b649eb142a
child 141751 8b99e97bb3dee268e13cada60e29d65f29318240
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersehsan
bugs888602
milestone26.0a1
Bug 888602 - Add null-check in mozInlineSpellChecker::ReplaceWord. r=ehsan
extensions/spellcheck/src/mozInlineSpellChecker.cpp
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -940,17 +940,18 @@ mozInlineSpellChecker::ReplaceWord(nsIDO
     nsCOMPtr<nsISelection> selection;
     res = editor->GetSelection(getter_AddRefs(selection));
     NS_ENSURE_SUCCESS(res, res);
     selection->RemoveAllRanges();
     selection->AddRange(range);
     editor->DeleteSelection(nsIEditor::eNone, nsIEditor::eStrip);
 
     nsCOMPtr<nsIPlaintextEditor> textEditor(do_QueryReferent(mEditor));
-    textEditor->InsertText(newword);
+    if (textEditor)
+      textEditor->InsertText(newword);
 
     editor->EndTransaction();
   }
 
   return NS_OK;
 }
 
 // mozInlineSpellChecker::AddWordToDictionary