Skip to content

Commit

Permalink
Fix AIIOB in Variable SET changer (#6600)
Browse files Browse the repository at this point in the history
* Update Variable.java

* test + ignore instead of set null

---------

Co-authored-by: Moderocky <[email protected]>
  • Loading branch information
sovdeeth and Moderocky authored Apr 27, 2024
1 parent 3e55190 commit d6322ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/ch/njol/skript/lang/Variable.java
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,10 @@ public void change(Event event, @Nullable Object[] delta, ChangeMode mode) throw
}
i++;
}
} else {
} else if (delta.length > 0) {
// if length = 0, likely a failure in casting
// (eg, set vector length of {_notvector} to 1, which casts delta to Vector[], resulting in an empty Vector array)
// so just do nothing.
set(event, delta[0]);
}
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test "variable set aiiob":
set vector length of {_} to 1

0 comments on commit d6322ad

Please sign in to comment.