Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-87587

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 15w35e, Minecraft 15w44b, Minecraft 15w47c, Minecraft 16w06a, Minecraft 16w07a, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, Minecraft 1.9.1 Pre-Release 2, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.1, Minecraft 1.9.2, Minecraft 1.11, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 17w13b
    • Confirmed

      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");
              }
          }
          //...
      }
      

        1. 2015-08-29_07.21.11.png
          2015-08-29_07.21.11.png
          30 kB
        2. 2016-12-05_10.24.28.png
          2016-12-05_10.24.28.png
          264 kB
        3. Sieppaa.JPG
          Sieppaa.JPG
          195 kB

            Unassigned Unassigned
            MrMine2000 Janis
            Votes:
            10 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: