From e892e571122498a1888b4b6b38bcead23313974c Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Wed, 2 Nov 2022 05:18:53 +0100 Subject: [Fix] Chat Listener index out of bounds (#416) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../io/github/moulberry/notenoughupdates/listener/ChatListener.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java index 6a94c0b3..fcd320fa 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java @@ -42,6 +42,7 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -125,7 +126,8 @@ public class ChatListener { String startsWith = null; boolean partyOrGuildChat = false; - if (chatComponent.getSiblings().get(0).getChatStyle().getChatClickEvent().getValue().startsWith("/viewprofile")) { + List siblings = chatComponent.getSiblings(); + if (!siblings.isEmpty() && siblings.get(0).getChatStyle().getChatClickEvent().getValue().startsWith("/viewprofile")) { startsWith = "/viewprofile"; partyOrGuildChat = true; } else { -- cgit