mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-21 11:44:55 +00:00
Fix wrong session index + save file corruption
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user