[SPIGOT-6285] ChatPaginator#wordWrap throws StringIndexOutOfBoundsException Created: 22/Dec/20 Updated: 27/Dec/20 |
|
Status: | Open |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | GhostTheWolf | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 0 |
Labels: | None |
Attachments: |
![]() |
Version: | This server is running CraftBukkit version git-Spigot-628435a-878b437 (MC: 1.16.4) (Implementing API version 1.16.4-R0.1-SNAPSHOT) |
Guidelines Read: | Yes |
Description |
The wordWrap method is throwing StringIndexOutOfBoundsException when wraping:
The problem seems to be related to colors, if I remove them it works normally. From the tests, I get that if the color block has a length bigger than that passed on the method it throws the exception.
I wrote a simple plugin to test that; it has a command /cpt <length> <string> So to reproduce, load the plugin and run any of:
PS.: I'm using & because the test plugin translates this symbol. |
Comments |
Comment by GhostTheWolf [ 27/Dec/20 ] |
Subtracting lineColorChars does fix the issues in those tests. But I also found another problem:
|
Comment by GhostTheWolf [ 26/Dec/20 ] |
@md_5 After reading the code, the problem seems to be on this line: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/util/ChatPaginator.java#96 It's not subtracting lineColorChars. I will be testing that later. |