Bug 880237 - Prevent crash in mozInlineSpellChecker::IgnoreWords by asserting mSpellCheck != null. r=ehsan

This commit is contained in:
Drew Willcoxon 2013-06-07 12:35:50 -07:00
parent 7fc49a98a4
commit 98105fd9ae

View File

@ -1015,6 +1015,8 @@ NS_IMETHODIMP
mozInlineSpellChecker::IgnoreWords(const PRUnichar **aWordsToIgnore,
uint32_t aCount)
{
NS_ENSURE_TRUE(mSpellCheck, NS_ERROR_NOT_INITIALIZED);
// add each word to the ignore list and then recheck the document
for (uint32_t index = 0; index < aCount; index++)
mSpellCheck->IgnoreWordAllOccurrences(aWordsToIgnore[index]);
@ -1413,6 +1415,8 @@ nsresult mozInlineSpellChecker::DoSpellCheck(mozInlineSpellWordUtil& aWordUtil,
{
*aDoneChecking = true;
NS_ENSURE_TRUE(mSpellCheck, NS_ERROR_NOT_INITIALIZED);
// get the editor for SkipSpellCheckForNode, this may fail in reasonable
// circumstances since the editor could have gone away
nsCOMPtr<nsIEditor> editor (do_QueryReferent(mEditor));