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

Client book length mismatch resulting in crash

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 20w17a
    • Minecraft 1.14, Minecraft 1.14.1 Pre-Release 1, Minecraft 1.14.1 Pre-Release 2, Minecraft 1.14.1, Minecraft 1.14.2 Pre-Release 1, Minecraft 1.14.2 Pre-Release 2, Minecraft 1.14.2 Pre-Release 3, Minecraft 1.14.2 Pre-Release 4, Minecraft 1.14.2, Minecraft 1.14.3 Pre-Release 1, Minecraft 1.14.3 Pre-Release 2, Minecraft 1.14.3 Pre-Release 3, Minecraft 1.14.3, Minecraft 1.14.4 Pre-Release 5, Minecraft 1.14.4 Pre-Release 6, 1.14.4 Pre-Release 7, 1.14.4, 1.15.1, 1.15.2, 20w17a
    • None
    • Community Consensus
    • Crash

      Editing (already once edited) books with colored content/'§' makes the client mismatch the actual character length, resulting in either one character too much (takes away another character) or too less (= § or following character still left) being deleted when removing characters.

      Concrete steps to reproduce:

      • start a 1.13.2 client, create a new singleplayer world, copy and paste any text with '§' characters in a book (see below), save world
      • start a 1.14.x client, convert/open the world, open the book

      Or use the following command in 1.14.x:

      /setblock ~ ~ ~ oak_sign{Text1:"{\"text\":\"Click me\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/give @p writable_book{pages:[\\\"\\u00a7nVery cool text\\n\\u00a7r \\u00a7\\u00a7\\u00a7\\u00a7 hi\\n\\u00a75more\\n\\u00a7etext\\\"]}\"}}"}
      

      What can be observed:

      • clicking on or marking the last character of the book -> crash
      • going to the last character with the right arrow doesn't go to the very end, but stops at a character before it
      • trying to remove characters where a '§' is results in seemingly the wrong character being removed
      • most notably: clicking the front on the second last line, then pressing the delete/backspace key removes characters a few letters behind the actually selected position

      This means that on a click in lines containing '§' the position/character length is calculated wrongly

      i.e. copy and paste

      §nVery cool text
      §r §§§§ hi
      
      §5and even more
      §etext
      

      The older 1.14.3 crash log had a different stacktrace , this is the latest

      1.15.2: crash-2020-04-28_15.38.46-client.txtjava.lang.StringIndexOutOfBoundsException: String index out of range: 44
      	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)
      	at java.base/java.lang.String.charAt(String.java:711)
      	at dch.a(SourceFile:454)
      	at dha.mouseClicked(SourceFile:779)
      	at dbo.b(SourceFile:86)
      	at dgb.wrapScreenError(SourceFile:447)
      	at dbo.a(SourceFile:86)
      	at dbo.c(SourceFile:150)
      	at ais.execute(SourceFile:94)
      	at dbo.b(SourceFile:150)
      	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36)
      	at org.lwjgl.system.JNI.invokeV(Native Method)
      	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101)
      	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(SourceFile:98)
      	at cxx.e(SourceFile:301)
      	at dbn.d(SourceFile:1012)
      	at dbn.d(SourceFile:619)
      	at net.minecraft.client.main.Main.main(SourceFile:204)
      

            Unassigned Unassigned
            KennyTV Nassim Jahnke
            Votes:
            18 Vote for this issue
            Watchers:
            22 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: