Fix random NullPointerException in SearchFragment

This commit is contained in:
Stypox 2021-03-28 22:18:23 +02:00
parent 9f59d4baa3
commit be4d12789d
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 7 additions and 6 deletions

View File

@ -139,7 +139,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
@State @State
boolean wasSearchFocused = false; boolean wasSearchFocused = false;
private Map<Integer, String> menuItemToFilterName; @Nullable private Map<Integer, String> menuItemToFilterName = null;
private StreamingService service; private StreamingService service;
private Page nextPage; private Page nextPage;
private boolean isSuggestionsEnabled = true; private boolean isSuggestionsEnabled = true;
@ -455,11 +455,12 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
} }
@Override @Override
public boolean onOptionsItemSelected(final MenuItem item) { public boolean onOptionsItemSelected(@NonNull final MenuItem item) {
if (menuItemToFilterName != null) {
final List<String> cf = new ArrayList<>(1); final List<String> cf = new ArrayList<>(1);
cf.add(menuItemToFilterName.get(item.getItemId())); cf.add(menuItemToFilterName.get(item.getItemId()));
changeContentFilter(item, cf); changeContentFilter(item, cf);
}
return true; return true;
} }