Fixed unaccurate logic in PanelBuilder#nextSlot()

This commit is contained in:
Florian CUNY 2018-06-02 21:41:27 +02:00
parent e7649f19d4
commit d7b2c70b78

View File

@ -71,10 +71,13 @@ public class PanelBuilder {
/** /**
* Get the next free slot number * Get the next free slot number
* @return next slot number * @return next slot number, or -1 in case none has been found.
*/ */
public int nextSlot() { public int nextSlot() {
return items.isEmpty() ? 0 : items.lastKey() + 1; for (int i = 0 ; i < (size == 0 ? 54 : size) ; i++) {
if (!slotOccupied(i)) return i;
}
return -1;
} }
/** /**