Skip to content

Commit

Permalink
Fix index out of bounds when cloning gui
Browse files Browse the repository at this point in the history
Closes #356
  • Loading branch information
virustotalop committed Jan 21, 2025
1 parent d30712c commit 5a0daf5
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ public boolean isStatic() {
public Gui clone() {
SimpleGui cloned = SerializationUtils.clone(this);
cloned.functions = this.functions;
for (Slot slot : this.slots) {
Slot clonedSlot = cloned.slots.get(slot.getIndex());
for (int i = 0; i < this.slots.size(); i++) {
Slot slot = this.slots.get(i);
Slot clonedSlot = cloned.slots.get(i);
if (clonedSlot instanceof SimpleSlot) {
SimpleSlot clonedSimpleSlot = (SimpleSlot) clonedSlot;
clonedSimpleSlot.setFunctions(slot.getFunctions());
Expand Down

0 comments on commit 5a0daf5

Please sign in to comment.