Closed EpicKnarvik97 closed 1 year ago
Well.... what did you do?
Well.... what did you do?
As specified in reproduction, I created a new hologram and deleted the default line (page 1 line 1). The deletion of the line itself seems to work fine, but for some reason, the plugin wants to remove page 2 (eu.decentsoftware.holograms.api.holograms.Hologram.removePage(Hologram.java:915)
) as well, without there being a page 2, which causes java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
.
Okay, I tested a bit more, and generally, it seems that whenever a page is removed because all lines for that page are removed, the index used for triggering page deletion is 1-indexed instead of 0-indexed. This does not happen when the page is removed directly using /dh page rem
.
The check in eu.decentsoftware.holograms.api.holograms.Hologram
line 911 in the removePage(int index) {
method: if (index < 0 || index > size()) {
might be part of the problem, as it should be if (index < 0 || index >= size()) {
to not exit bounds. Fixing that should at least prevent the stack trace.
The other problem seems that in LineSubCommand line 642 (hologram.removePage(pageIndex);
), the index supplied is the user's 1-indexed input which hasn't been converted to 0-indexed.
Just making sure
Reproduction
test
Solution
It seems the problem causes an IndexOutOfBoundsException related to removing the first page. You should probably check that the index is in bounds when removing from the pages array.
Server Version
Paper 1.19.4 550
Client Version
1.20.1
Plugin Version
2.8.3
Log
https://pastebin.com/H5ZkhGYH