Skip to content

Commit

Permalink
fixes off-by-one bug in slice iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoff-it committed Aug 30, 2024
1 parent d8ab33c commit dc7e4d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/context/Iterator.zig
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ fn SliceIterator(comptime Element: type) type {
pub fn next(self: *@This(), gpa: Allocator) !?Element {
_ = gpa;
if (self.idx == self.items.len) return null;
self.idx += 1;
defer self.idx += 1;
return self.items[self.idx];
}
};
Expand Down

0 comments on commit dc7e4d3

Please sign in to comment.