Fix off-by-1 in WMArray iteration #26

Merged
trurl merged 2 commits from trurl/wmaker:refactor/riir into refactor/riir 2026-04-04 12:51:46 -04:00
2 changed files with 3 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

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;