Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

Check if string empty before substringing #7

Open
goreacraft opened this issue Aug 19, 2016 · 0 comments
Open

Check if string empty before substringing #7

goreacraft opened this issue Aug 19, 2016 · 0 comments

Comments

@goreacraft
Copy link

Hello,

I think there is a problem in MessageMeddler.java at line 20 as it does not check if a string is emtiefirst and crashes client each time it recieves one.
(Empty strings are be used on servers to format the chat and sent nice things for players to read)

Thank you,

[13:19:17] [Client thread/FATAL]: Unreported exception thrown!
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
at java.lang.String.substring(Unknown Source) ~[?:1.8.0_91]
at vazkii.chatflow.MessageMeddler.onMessageReceived(MessageMeddler.java:20) ~[MessageMeddler.class:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler_178_MessageMeddler_onMessageReceived_ClientChatReceivedEvent.invoke(.dynamic) ~[?:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?]
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) ~[EventBus.class:?]
at net.minecraft.client.network.NetHandlerPlayClient.func_147251_a(NetHandlerPlayClient.java:694) ~[bjb.class:?]
at net.minecraft.network.play.server.S02PacketChat.func_148833_a(SourceFile:38) ~[gj.class:?]
at net.minecraft.network.play.server.S02PacketChat.func_148833_a(SourceFile:9) ~[gj.class:?]
at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) ~[ej.class:?]
at net.minecraft.client.multiplayer.PlayerControllerMP.func_78765_e(PlayerControllerMP.java:273) ~[bje.class:?]
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1602) ~[bao.class:?]
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973) ~[bao.class:?]
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898) [bao.class:?]
at net.minecraft.client.main.Main.main(SourceFile:148) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant