From 3ff5158b6f783eaffcb090bf097d89f4320c8e41 Mon Sep 17 00:00:00 2001 From: Max-Wilhelm Bruker Date: Tue, 2 Aug 2011 21:10:38 +0200 Subject: [PATCH] server crash fix --- common/server.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/server.cpp b/common/server.cpp index bf3e19a9..a1ee532c 100644 --- a/common/server.cpp +++ b/common/server.cpp @@ -56,9 +56,13 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString if (authState == PasswordWrong) return authState; + ServerInfo_User *data = getUserData(name); + name = data->getName(); // Compensate for case indifference + if (authState == PasswordRight) { if (users.contains(name)) { qDebug("Login denied: would overwrite old session"); + delete data; return WouldOverwriteOldSession; } } else if (authState == UnknownUser) { @@ -71,8 +75,6 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString name = tempName; } - ServerInfo_User *data = getUserData(name); - name = data->getName(); // Compensate for case indifference session->setUserInfo(data); users.insert(name, session);