summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/chat_manager.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index b7f7001ae0..0a89030837 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -713,15 +713,15 @@ USERINFO* UM_AddUser(SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *psz
return nullptr;
auto *pUser = UM_FindUser(si, pszUID);
- if (pUser)
- return pUser;
-
- pUser = new USERINFO();
- pUser->pszUID = mir_wstrdup(pszUID);
- pUser->pszNick = mir_wstrdup(pszNick);
+ if (pUser == nullptr) {
+ pUser = new USERINFO();
+ si->getKeyList().insert(pUser);
+ si->getUserList().insert(pUser);
+ }
+
+ replaceStrW(pUser->pszUID, pszUID);
+ replaceStrW(pUser->pszNick, pszNick);
pUser->Status = wStatus;
- si->getKeyList().insert(pUser);
- si->getUserList().insert(pUser);
return pUser;
}