Chat Tweaks

Chat Tweaks

492k Downloads

Crashes if the emote spam hits it just right in the good spot

ZeekDaGeek opened this issue ยท 2 comments

commented

"It would totally be fine in 1.10" she said. "The problem is that you're using 1.7.10" she said. LIES LIES AND PROPAGANDA! IT CRASHES!

java.lang.StringIndexOutOfBoundsException: String index out of range: 84
	at java.lang.String.substring(String.java:1950)
	at net.blay09.mods.bmc.handler.RenderHandler.onDrawChatMessagePost(RenderHandler.java:81)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_117_RenderHandler_onDrawChatMessagePost_Post.invoke(.dynamic)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185)
	at net.blay09.mods.bmc.coremod.CoremodHelper.drawChatMessagePost(CoremodHelper.java:29)
	at net.minecraft.client.gui.GuiNewChat.func_146230_a(SourceFile:97)
	at net.minecraftforge.client.GuiIngameForge.renderChat(GuiIngameForge.java:804)
	at net.minecraftforge.client.GuiIngameForge.func_175180_a(GuiIngameForge.java:197)
	at net.minecraft.client.renderer.EntityRenderer.func_181560_a(EntityRenderer.java:1072)
	at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1076)
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:371)
	at net.minecraft.client.main.Main.main(SourceFile:124)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
commented

IT CRASHED AGAIN YOU MONSTER! geekRage

commented

Psstt I think I see the problem:

https://github.com/blay09/BetterMinecraftChat/blob/1.10/src/main/java/net/blay09/mods/bmc/handler/RenderHandler.java#L80

Happens when substring defaults to text.length(). The length of the file is 1 higher then the possible indexes that substring can reference.

					int offset = Math.min(formattedText.length() - 1, image.getIndex() - thisOffset + (wrappedLinesBefore * 2) + 1);