From 933be66941a98a8bbeb9729a06f2a589a08ea15c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 20 Nov 2023 16:12:32 +0300 Subject: fixes #3938 (ICQ: crash) --- protocols/ICQ-WIM/src/server.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'protocols') diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index d85bcc3365..cc63593a3a 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -339,9 +339,9 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact, boo // user chat? CMStringW wszId(buddy["aimId"].as_mstring()); if (IsChat(wszId)) { - auto *pUser = FindUser(wszId); - if (pUser && pUser->m_iApparentMode == ID_STATUS_OFFLINE) - return INVALID_CONTACT_ID; + if (auto *pUser = FindUser(wszId)) + if (pUser->m_iApparentMode == ID_STATUS_OFFLINE) + return INVALID_CONTACT_ID; CMStringW wszChatName(buddy["friendly"].as_mstring()); auto *si = CreateGroupChat(wszId, wszChatName); @@ -353,8 +353,10 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact, boo if (bIgnored) return INVALID_CONTACT_ID; + debugLogA("creating a user with id=%S", wszId.c_str()); hContact = CreateContact(wszId, false); - FindUser(wszId)->m_bInList = true; + if (auto *pUser = FindUser(wszId)) + pUser->m_bInList = true; } else if (bIgnored) { db_delete_contact(hContact, true); -- cgit v1.2.3