change the way of avoiding an IndexOutOfBoundsException

This commit is contained in:
l4zs
2021-09-23 20:12:11 +02:00
parent b7d6523939
commit 3b04ea743f

View File

@@ -61,7 +61,7 @@ abstract class AbstractGUISpaceCompound<T : ForInventory, E> internal constructo
private fun recalculateCurrentContent() {
if (scrollProgress > content.size)
throw IllegalStateException("The scrollProgress is greater than the content size.")
scrollProgress = content.size
// avoid IndexOutOfBoundsException
var sliceUntil = internalSlots.size + scrollProgress
if (sliceUntil > content.lastIndex)