diff --git a/ZkLobbyServer/ConnectedUser.cs b/ZkLobbyServer/ConnectedUser.cs index 9be0b456f5..effca57b32 100644 --- a/ZkLobbyServer/ConnectedUser.cs +++ b/ZkLobbyServer/ConnectedUser.cs @@ -629,15 +629,16 @@ public async Task RemoveConnection(ClientConnection con, string reason) if (server.ConnectedUsers.TryRemove(Name, out connectedUser)) { + int accountID = User.AccountID; connectedUser.ResetHasSeen(); + connectedUser.User.AccountID = 0; using (var db = new ZkDataContext()) { - var acc = await db.Accounts.FindAsync(User.AccountID); + var acc = await db.Accounts.FindAsync(accountID); acc.LastLogout = DateTime.UtcNow; await db.SaveChangesAsync(); } - connectedUser.User.AccountID = 0; } } }