Skip to content

Commit e4fcda3

Browse files
Throw exception on empty content list slots
1 parent d1351ce commit e4fcda3

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

invui/src/main/java/xyz/xenondevs/invui/gui/AbstractPagedGui.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ sealed abstract class AbstractPagedGui<C>
2323

2424
public AbstractPagedGui(int width, int height, boolean infinitePages, int... contentListSlots) {
2525
super(width, height);
26+
if (contentListSlots.length == 0)
27+
throw new IllegalArgumentException("Content list slots must not be empty");
28+
2629
this.infinitePages = infinitePages;
2730
this.contentListSlots = contentListSlots;
2831
}

invui/src/main/java/xyz/xenondevs/invui/gui/AbstractScrollGui.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ sealed abstract class AbstractScrollGui<C>
2727

2828
public AbstractScrollGui(int width, int height, boolean infiniteLines, int... contentListSlots) {
2929
super(width, height);
30+
if (contentListSlots.length == 0)
31+
throw new IllegalArgumentException("Content list slots must not be empty");
32+
3033
this.infiniteLines = infiniteLines;
3134
this.contentListSlots = contentListSlots;
3235
this.lineLength = SlotUtils.getLongestLineLength(contentListSlots, width);

invui/src/main/java/xyz/xenondevs/invui/gui/AbstractTabGui.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ sealed abstract class AbstractTabGui<C extends Gui>
2121

2222
public AbstractTabGui(int width, int height, int tabAmount, int... listSlots) {
2323
super(width, height);
24+
if (listSlots.length == 0)
25+
throw new IllegalArgumentException("Content list slots must not be empty");
26+
2427
this.tabAmount = tabAmount;
2528
this.listSlots = listSlots;
2629
}

0 commit comments

Comments
 (0)