File tree 1 file changed +4
-0
lines changed
src/main/java/net/dv8tion/jda/internal/requests/restaction/order
1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,8 @@ public M moveTo(int position)
208
208
{
209
209
Checks .notNegative (position , "Provided position" );
210
210
Checks .check (position < orderList .size (), "Provided position is too big and is out of bounds." );
211
+ if (selectedPosition == -1 )
212
+ throw new IllegalStateException ("Cannot move until an item has been selected. Use #selectPosition first." );
211
213
212
214
T selectedItem = orderList .remove (selectedPosition );
213
215
orderList .add (position , selectedItem );
@@ -250,6 +252,8 @@ public M swapPosition(int swapPosition)
250
252
Checks .notNegative (swapPosition , "Provided swapPosition" );
251
253
Checks .check (swapPosition < orderList .size (), "Provided swapPosition is too big and is out of bounds. swapPosition: "
252
254
+ swapPosition );
255
+ if (selectedPosition == -1 )
256
+ throw new IllegalStateException ("Cannot move until an item has been selected. Use #selectPosition first." );
253
257
254
258
T selectedItem = orderList .get (selectedPosition );
255
259
T swapItem = orderList .get (swapPosition );
You can’t perform that action at this time.
0 commit comments