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
Родитель 44860262c7
Коммит fecf914058
1 изменённых файлов: 5 добавлений и 6 удалений

Просмотреть файл

@ -161,7 +161,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
mUserEnteredTextView.setText(searchTerm); mUserEnteredTextView.setText(searchTerm);
// mSearchEngine is not set in the first call to this method; the content description // 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) { if (mSearchEngine != null) {
setDescriptionOnSuggestion(mUserEnteredTextView, searchTerm); setDescriptionOnSuggestion(mUserEnteredTextView, searchTerm);
} }
@ -243,10 +243,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
hideRecycledSuggestions(suggestionCounter, recycledSuggestionCount); hideRecycledSuggestions(suggestionCounter, recycledSuggestionCount);
} }
private int updateFromSearchEngine(SearchEngine searchEngine, boolean animate, int recycledSuggestionCount) { private int updateFromSearchEngine(boolean animate, int recycledSuggestionCount) {
// Update search engine reference.
mSearchEngine = searchEngine;
// Set the search engine icon (e.g., Google) for the row. // Set the search engine icon (e.g., Google) for the row.
mIconView.updateAndScaleImage(mSearchEngine.getIcon(), mSearchEngine.getEngineIdentifier()); 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) { 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. // This can be called before the opt-in permission prompt is shown or set. Check first.
if (suggestionsEnabled) { if (suggestionsEnabled) {
final int recycledSuggestionCount = mSuggestionView.getChildCount(); final int recycledSuggestionCount = mSuggestionView.getChildCount();
final int suggestionViewCount = updateFromSearchEngine(searchEngine, animate, recycledSuggestionCount); final int suggestionViewCount = updateFromSearchEngine(animate, recycledSuggestionCount);
if (AppConstants.NIGHTLY_BUILD) { if (AppConstants.NIGHTLY_BUILD) {
updateFromSavedSearches(searchTerm, animate, suggestionViewCount, recycledSuggestionCount); updateFromSavedSearches(searchTerm, animate, suggestionViewCount, recycledSuggestionCount);
} }