fix crash on delayed context menu taps on feeds

This commit is contained in:
dosiecki 2018-03-21 15:32:09 -07:00
parent d79be508d4
commit 85971b6f0d
2 changed files with 7 additions and 2 deletions

View file

@ -736,6 +736,8 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
/** Get the cached Feed object for the feed at the given list location. */
public synchronized Feed getFeed(int groupPosition, int childPosition) {
if (groupPosition > activeFolderChildren.size()) return null;
if (childPosition > activeFolderChildren.get(groupPosition).size()) return null;
return activeFolderChildren.get(groupPosition).get(childPosition);
}

View file

@ -346,8 +346,11 @@ public class FolderListFragment extends NbFragment implements OnCreateContextMen
markFeedsAsRead(fs);
return true;
} else if (item.getItemId() == R.id.menu_choose_folders) {
DialogFragment chooseFoldersFragment = ChooseFoldersFragment.newInstance(adapter.getFeed(groupPosition, childPosition));
chooseFoldersFragment.show(getFragmentManager(), "dialog");
Feed feed = adapter.getFeed(groupPosition, childPosition);
if (feed != null) {
DialogFragment chooseFoldersFragment = ChooseFoldersFragment.newInstance(feed);
chooseFoldersFragment.show(getFragmentManager(), "dialog");
}
} else if (item.getItemId() == R.id.menu_mute_feed) {
Set<String> feedIds = new HashSet<String>();
feedIds.add(adapter.getFeed(groupPosition, childPosition).feedId);