From 3b04ea743fc895b7afdebf8e4fb85c5d761396f3 Mon Sep 17 00:00:00 2001 From: l4zs Date: Thu, 23 Sep 2021 20:12:11 +0200 Subject: [PATCH] change the way of avoiding an IndexOutOfBoundsException --- .../kotlin/net/axay/kspigot/gui/elements/GUISpaceCompound.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/net/axay/kspigot/gui/elements/GUISpaceCompound.kt b/src/main/kotlin/net/axay/kspigot/gui/elements/GUISpaceCompound.kt index b3fdddc7..41394652 100644 --- a/src/main/kotlin/net/axay/kspigot/gui/elements/GUISpaceCompound.kt +++ b/src/main/kotlin/net/axay/kspigot/gui/elements/GUISpaceCompound.kt @@ -61,7 +61,7 @@ abstract class AbstractGUISpaceCompound 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)