Bug 1100403 - Don't read mAdapter if null r?margaret
--- a/mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java
@@ -1119,28 +1119,32 @@ public class BrowserSearch extends HomeF
private class CursorLoaderCallbacks implements LoaderCallbacks<Cursor> {
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
return SearchLoader.createInstance(getActivity(), args);
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor c) {
- mAdapter.swapCursor(c);
+ if (mAdapter != null) {
+ mAdapter.swapCursor(c);
- // We should handle autocompletion based on the search term
- // associated with the loader that has just provided
- // the results.
- SearchCursorLoader searchLoader = (SearchCursorLoader) loader;
- handleAutocomplete(searchLoader.getSearchTerm(), c);
+ // We should handle autocompletion based on the search term
+ // associated with the loader that has just provided
+ // the results.
+ SearchCursorLoader searchLoader = (SearchCursorLoader) loader;
+ handleAutocomplete(searchLoader.getSearchTerm(), c);
+ }
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
- mAdapter.swapCursor(null);
+ if (mAdapter != null) {
+ mAdapter.swapCursor(null);
+ }
}
}
private class SearchEngineSuggestionLoaderCallbacks implements LoaderCallbacks<ArrayList<String>> {
@Override
public Loader<ArrayList<String>> onCreateLoader(int id, Bundle args) {
// mSuggestClient is set to null in onDestroyView(), so using it
// safely here relies on the fact that onCreateLoader() is called