Fix off-by-one error in WMArray iteration macro behavior

This commit is contained in:
2026-03-31 11:17:36 -04:00
parent 2aa0b0bf53
commit efec1e8d1e
+3 -3
View File
@@ -359,7 +359,7 @@ pub mod ffi {
if index < 0 {
return ptr::null_mut();
}
match array.items.get(index as usize) {
match array.items.get(index as usize + 1) {
Some(i) => {
unsafe {
*iter += 1;
@@ -382,10 +382,10 @@ pub mod ffi {
}
let array = unsafe { &*array };
let index = unsafe { *iter };
if index < 0 {
if index < 1 {
return ptr::null_mut();
}
match array.items.get(index as usize) {
match array.items.get(index as usize - 1) {
Some(i) => {
unsafe {
*iter -= 1;