Changed argument check order in ScrollGUI

This commit is contained in:
NichtStudioCode 2022-06-16 16:55:16 +02:00
parent 749bd35a26
commit 2fa6fef168

@ -29,10 +29,10 @@ public abstract class ScrollGUI extends BaseGUI {
this.lineLength = SlotUtils.getLongestLineLength(itemListSlots, width); this.lineLength = SlotUtils.getLongestLineLength(itemListSlots, width);
this.lineAmount = (int) Math.ceil((double) itemListSlots.length / (double) lineLength); this.lineAmount = (int) Math.ceil((double) itemListSlots.length / (double) lineLength);
if (lineLength == 0)
throw new IllegalArgumentException("Line length can't be 0");
if (itemListSlots.length == 0) if (itemListSlots.length == 0)
throw new IllegalArgumentException("No item list slots provided"); throw new IllegalArgumentException("No item list slots provided");
if (lineLength == 0)
throw new IllegalArgumentException("Line length can't be 0");
if (itemListSlots.length % lineLength != 0) if (itemListSlots.length % lineLength != 0)
throw new IllegalArgumentException("itemListSlots has to be a multiple of lineLength"); throw new IllegalArgumentException("itemListSlots has to be a multiple of lineLength");
} }