mojira.dev
MC-87587

Server kicks client when executing: /title @a title [] or tellraw @a []

The bug

When this command is executed:

/title @a title []

it kicks me from the world/server and displays this error:

Internal Exception: io.netty.handler.codec.DecoderException: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1

In 1.8 the command was working.

Code analysis

The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.

This bug would be fixed by using the "fix" provided for MC-55373.

The reason why this happens is because the method net.minecraft.util.text.ITextComponent.Serializer.deserialize(JsonElement, Type, JsonDeserializationContext) returns null when parsing an empty array because it only sets the chat component which should be returned to a value if the array contains items.

public ITextComponent deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    if (p_deserialize_1_.isJsonPrimitive())
    {
        return new TextComponentString(p_deserialize_1_.getAsString());
    }
    else if (!p_deserialize_1_.isJsonObject())
    {
        if (p_deserialize_1_.isJsonArray())
        {
            JsonArray jsonarray1 = p_deserialize_1_.getAsJsonArray();
            ITextComponent itextcomponent1 = null;

            // No items are in the array meaning "itextcomponent1" stays "null"
            for (JsonElement jsonelement : jsonarray1)
            {
                ITextComponent itextcomponent2 = this.deserialize(jsonelement, jsonelement.getClass(), p_deserialize_3_);

                if (itextcomponent1 == null)
                {
                    itextcomponent1 = itextcomponent2;
                }
                else
                {
                    itextcomponent1.appendSibling(itextcomponent2);
                }
            }

            return itextcomponent1;
        }
        else
        {
            throw new JsonParseException("Don\'t know how to turn " + p_deserialize_1_.toString() + " into a Component");
        }
    }
    //...
}

Linked issues

Attachments

Comments 17

migrated

Attach the full crash report

kumasasa

There is no crash, just a kick,

migrated

Ah, I see, just for anyone else reading, the report previously said crash

kumasasa

That's true:

@unknown made changes - an hour ago

Summary

Crash on this command: /title @a title []

Server kicks client when executing: /title @a title []

migrated

Can confirm the issue affects LAN and Server in latest snapshots to date.
(Latest Checked: 15w44b)
I do believe that similar issues occurred in snapshots last year before final release, the final release (or later snapshots) stated that finally the title command was fixed.

7 more comments
migrated

This bug still works in 1.11 servers. The worst part is that you can use /tellraw Username [] to kick someone. This is annoying because people use it in realms and /kick does not work there. Please fix it in 1.11.1

migrated

Confirmed for 1.11.2

migrated

confirmed for 17w13b

migrated

Cannot reproduce in 17w50a, instead I get this message in the chat: java.lang.NullPointerException

NeunEinser

As for 1.13-pre3 I get the error feedback message

Invalid chat component: empty

Therefore, cannot be reproduced any longer.

migrated

(Unassigned)

Confirmed

json, server, tellraw, title

Minecraft 15w35e, Minecraft 15w44b, Minecraft 15w47c, Minecraft 16w06a, Minecraft 16w07a, ..., Minecraft 1.9.2, Minecraft 1.11, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 17w13b

Minecraft 16w35a, Minecraft 1.13-pre3

Retrieved