Skip to content

Commit

Permalink
Fix crash while typing "/" in chat (#615)
Browse files Browse the repository at this point in the history
Co-authored-by: Andy <[email protected]>
  • Loading branch information
Earthcomputer and DeltAndy123 committed Mar 29, 2024
1 parent 2bd2d6c commit 1b9b344
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ private String onHandleChatInput(String message) {

@Inject(method = "onEdited", at = @At("HEAD"))
private void onEdited(String value, CallbackInfo ci) {
if (value.startsWith("/") && ClientCommands.isClientcommandsCommand(value.substring(1).split(" ")[0])) {
boolean isClientcommandsCommand = false;
if (value.startsWith("/")) {
String[] commandArgs = value.substring(1).split(" ");
isClientcommandsCommand = commandArgs.length > 0 && ClientCommands.isClientcommandsCommand(commandArgs[0]);
}
if (isClientcommandsCommand) {
if (oldMaxLength == null) {
oldMaxLength = input.maxLength;
}
Expand Down

0 comments on commit 1b9b344

Please sign in to comment.