Bug 1202583 - crash in java.lang.NullPointerException: Attempt to read from field ''java.lang.String org.mozilla.gecko.home.SearchEngine.name'' on a null object reference.r=mfinkle

This commit is contained in:
Allison Naaktgeboren 2015-09-13 13:13:43 -07:00
parent 3cfa3e89c4
commit 9c6700e443

View File

@ -161,7 +161,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
mUserEnteredTextView.setText(searchTerm);
// mSearchEngine is not set in the first call to this method; the content description
// is instead initially set in updateFromSearchEngine.
// is instead initially set in updateSuggestions().
if (mSearchEngine != null) {
setDescriptionOnSuggestion(mUserEnteredTextView, searchTerm);
}
@ -243,10 +243,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
hideRecycledSuggestions(suggestionCounter, recycledSuggestionCount);
}
private int updateFromSearchEngine(SearchEngine searchEngine, boolean animate, int recycledSuggestionCount) {
// Update search engine reference.
mSearchEngine = searchEngine;
private int updateFromSearchEngine(boolean animate, int recycledSuggestionCount) {
// Set the search engine icon (e.g., Google) for the row.
mIconView.updateAndScaleImage(mSearchEngine.getIcon(), mSearchEngine.getEngineIdentifier());
@ -271,10 +268,12 @@ class SearchEngineRow extends AnimatedHeightLayout {
}
public void updateSuggestions(boolean suggestionsEnabled, SearchEngine searchEngine, String searchTerm, boolean animate) {
// Update search engine reference. Even if the user has not seen the prompt, we need to set the engine for the mSearchTerm suggestion
mSearchEngine = searchEngine;
// This can be called before the opt-in permission prompt is shown or set. Check first.
if (suggestionsEnabled) {
final int recycledSuggestionCount = mSuggestionView.getChildCount();
final int suggestionViewCount = updateFromSearchEngine(searchEngine, animate, recycledSuggestionCount);
final int suggestionViewCount = updateFromSearchEngine(animate, recycledSuggestionCount);
if (AppConstants.NIGHTLY_BUILD) {
updateFromSavedSearches(searchTerm, animate, suggestionViewCount, recycledSuggestionCount);
}