Merge "Fix NPE when calling getSuggestionV2 in adapter."
This commit is contained in:
committed by
Android (Google) Code Review
commit
10ba1f1ee7
@@ -220,6 +220,9 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder>
|
||||
|
||||
public Tile getSuggestion(int position) {
|
||||
final long itemId = getItemId(position);
|
||||
if (mSuggestions == null) {
|
||||
return null;
|
||||
}
|
||||
for (Tile tile : mSuggestions) {
|
||||
if (Objects.hash(tile.title) == itemId) {
|
||||
return tile;
|
||||
@@ -230,6 +233,9 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder>
|
||||
|
||||
public Suggestion getSuggestionsV2(int position) {
|
||||
final long itemId = getItemId(position);
|
||||
if (mSuggestionsV2 == null) {
|
||||
return null;
|
||||
}
|
||||
for (Suggestion suggestion : mSuggestionsV2) {
|
||||
if (Objects.hash(suggestion.getId()) == itemId) {
|
||||
return suggestion;
|
||||
|
Reference in New Issue
Block a user