From 7d0b44d6384fa5c916c462f30a0c30fd8f1338fc Mon Sep 17 00:00:00 2001 From: Kam Date: Wed, 23 Jul 2025 13:52:48 -0400 Subject: [PATCH] fix StringIndexOutOfBounds in GuiScriptTextArea --- .../java/noppes/npcs/client/gui/util/GuiScriptTextArea.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java b/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java index 205351715..5b8fe32c7 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java @@ -91,7 +91,8 @@ public class GuiScriptTextArea extends GuiNpcTextField { scrolledLine = Math.min(Math.max((int) (1f * diff * (yMouse - y) / height), 0), diff); } int startBracket = 0, endBracket = 0; - if (endSelection - startSelection == 1 || startSelection == endSelection && startSelection < text.length()) { + if (startSelection >= 0 && startSelection < text.length() && + (endSelection - startSelection == 1 || startSelection == endSelection)) { char c = text.charAt(startSelection); int found = 0; if (c == '{') {