diff options
author | isXander <xander@isxander.dev> | 2023-04-04 11:16:31 +0100 |
---|---|---|
committer | isXander <xander@isxander.dev> | 2023-04-04 11:16:31 +0100 |
commit | b98f9b6ec98a69955fc45cd6d1b8796f14ee9cb5 (patch) | |
tree | b8e8203607a2cf8f7cda5fcdeae8ed52ec3978f5 /src/client/java/dev | |
parent | c5917e9854958adf1e4aa1aa22251f7b3f911d38 (diff) | |
download | YetAnotherConfigLib-b98f9b6ec98a69955fc45cd6d1b8796f14ee9cb5.tar.gz YetAnotherConfigLib-b98f9b6ec98a69955fc45cd6d1b8796f14ee9cb5.tar.bz2 YetAnotherConfigLib-b98f9b6ec98a69955fc45cd6d1b8796f14ee9cb5.zip |
🐛 fix crash IOOB on StringControllerElement after resetting
Diffstat (limited to 'src/client/java/dev')
-rw-r--r-- | src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java b/src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java index ce9d252..cb2ad4e 100644 --- a/src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java +++ b/src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java @@ -67,6 +67,9 @@ public class StringControllerElement extends ControllerWidget<IStringController< GuiComponent.fill(matrices, inputFieldBounds.x() + 1, inputFieldBounds.yLimit() + 1, inputFieldBounds.xLimit() + 1, inputFieldBounds.yLimit() + 2, 0xFF404040); if (inputFieldFocused || focused) { + if (caretPos > text.length()) + caretPos = text.length(); + int caretX = textX + textRenderer.width(text.substring(0, caretPos)) - 1; if (text.isEmpty()) caretX = inputFieldBounds.x() + inputFieldBounds.width() / 2; |