aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2022-11-02 05:18:53 +0100
committerGitHub <noreply@github.com>2022-11-02 15:18:53 +1100
commite892e571122498a1888b4b6b38bcead23313974c (patch)
tree1e7f12f29123b05600d35ca761d888e159548f53 /src/main/java/io
parentabe71be0da84bfc5d765c002cea4bf1950fe49e1 (diff)
downloadNotEnoughUpdates-e892e571122498a1888b4b6b38bcead23313974c.tar.gz
NotEnoughUpdates-e892e571122498a1888b4b6b38bcead23313974c.tar.bz2
NotEnoughUpdates-e892e571122498a1888b4b6b38bcead23313974c.zip
[Fix] Chat Listener index out of bounds (#416)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java4
1 files changed, 3 insertions, 1 deletions
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<IChatComponent> siblings = chatComponent.getSiblings();
+ if (!siblings.isEmpty() && siblings.get(0).getChatStyle().getChatClickEvent().getValue().startsWith("/viewprofile")) {
startsWith = "/viewprofile";
partyOrGuildChat = true;
} else {