Prevent ArrayIndexOutOfBoundsException
This commit is contained in:
parent
3a150ac428
commit
a98ed53625
|
@ -400,6 +400,9 @@ public class QueueFragment extends Fragment {
|
||||||
int from = viewHolder.getAdapterPosition();
|
int from = viewHolder.getAdapterPosition();
|
||||||
int to = target.getAdapterPosition();
|
int to = target.getAdapterPosition();
|
||||||
Log.d(TAG, "move(" + from + ", " + to + ")");
|
Log.d(TAG, "move(" + from + ", " + to + ")");
|
||||||
|
if(from >= queue.size() || to >= queue.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
queue.add(to, queue.remove(from));
|
queue.add(to, queue.remove(from));
|
||||||
recyclerAdapter.notifyItemMoved(from, to);
|
recyclerAdapter.notifyItemMoved(from, to);
|
||||||
DBWriter.moveQueueItem(from, to, true);
|
DBWriter.moveQueueItem(from, to, true);
|
||||||
|
|
Loading…
Reference in New Issue