mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-01-12 00:47:17 +01:00
fix #3768 double check the item is still in the queue
This commit is contained in:
parent
e0236361a4
commit
c7ec68193b
@ -472,15 +472,19 @@ public class QueueFragment extends Fragment {
|
||||
return super.onContextItemSelected(item);
|
||||
}
|
||||
|
||||
int position = FeedItemUtil.indexOfItemWithId(queue, selectedItem.getId());
|
||||
if (position < 0) {
|
||||
Log.i(TAG, "Selected item no longer exist, ignoring selection");
|
||||
return super.onContextItemSelected(item);
|
||||
}
|
||||
|
||||
switch(item.getItemId()) {
|
||||
case R.id.move_to_top_item:
|
||||
int position = FeedItemUtil.indexOfItemWithId(queue, selectedItem.getId());
|
||||
queue.add(0, queue.remove(position));
|
||||
recyclerAdapter.notifyItemMoved(position, 0);
|
||||
DBWriter.moveQueueItemToTop(selectedItem.getId(), true);
|
||||
return true;
|
||||
case R.id.move_to_bottom_item:
|
||||
position = FeedItemUtil.indexOfItemWithId(queue, selectedItem.getId());
|
||||
queue.add(queue.size()-1, queue.remove(position));
|
||||
recyclerAdapter.notifyItemMoved(position, queue.size()-1);
|
||||
DBWriter.moveQueueItemToBottom(selectedItem.getId(), true);
|
||||
|
Loading…
Reference in New Issue
Block a user