Bug 674353 - Avoid using null pointer when trying to autocomplete. r=mak
authorJosh Matthews <josh@joshmatthews.net>
Thu, 26 Jan 2012 14:15:58 -0500
changeset 86741 863a1db98fbe52af7e862755f3b75dd1245b4ef7
parent 86740 0e4ff4aa33a6c527295d8b225d1be081ac0c8fc0
child 86742 547cea3b54fdcc10164e1333743ae7c56516e719
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs674353
milestone12.0a1
Bug 674353 - Avoid using null pointer when trying to autocomplete. r=mak
toolkit/components/autocomplete/nsAutoCompleteController.cpp
--- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
@@ -1386,17 +1386,17 @@ nsAutoCompleteController::ClearResults()
     }
   }
   return NS_OK;
 }
 
 nsresult
 nsAutoCompleteController::CompleteDefaultIndex(PRInt32 aResultIndex)
 {
-  if (mDefaultIndexCompleted || mBackspaced || mSearchString.Length() == 0)
+  if (mDefaultIndexCompleted || mBackspaced || mSearchString.Length() == 0 || !mInput)
     return NS_OK;
 
   PRInt32 selectionStart;
   mInput->GetSelectionStart(&selectionStart);
   PRInt32 selectionEnd;
   mInput->GetSelectionEnd(&selectionEnd);
 
   // Don't try to automatically complete to the first result if there's already