Fix wrong session index + save file corruption

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion
2025-12-06 14:25:01 +01:00
parent a9ff0a6d07
commit e6966a628c
5 changed files with 26 additions and 3 deletions

View File

@@ -5,6 +5,8 @@ const SavedUsers = @This();
const User = struct {
username: []const u8,
session_index: usize,
first_run: bool,
allocated_username: bool,
};
user_list: std.ArrayList(User),
@@ -18,5 +20,9 @@ pub fn init() SavedUsers {
}
pub fn deinit(self: *SavedUsers, allocator: std.mem.Allocator) void {
for (self.user_list.items) |user| {
if (user.allocated_username) allocator.free(user.username);
}
self.user_list.deinit(allocator);
}