From 777b9bc02bec68f5075cf6cc7a17b2c1ef2bde91 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 10 May 2021 20:24:47 +0300 Subject: ICQ: fix for very rare crash on login --- protocols/ICQ-WIM/src/proto.h | 2 +- protocols/ICQ-WIM/src/server.cpp | 6 +++++- protocols/ICQ-WIM/src/version.h | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index 163fc56b3a..b6e785a0c4 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -270,7 +270,7 @@ class CIcqProto : public PROTO void CheckLastId(MCONTACT hContact, const JSONNode&); void Json2int(MCONTACT, const JSONNode&, const char *szJson, const char *szSetting); void Json2string(MCONTACT, const JSONNode&, const char *szJson, const char *szSetting); - MCONTACT ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact = -1); + MCONTACT ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact = INVALID_CONTACT_ID); void ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNode &msg, bool bCreateRead, bool bLocalTime); void OnLoggedIn(void); diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 2680fae71f..024fc34aa8 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -293,7 +293,11 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact) return si->hContact; } - if (hContact == -1) { + if (hContact == INVALID_CONTACT_ID) { + if (wszId.IsEmpty()) { + debugLogA("no aimId in packet? so strange..."); + return INVALID_CONTACT_ID; + } hContact = CreateContact(wszId, false); FindContactByUIN(wszId)->m_bInList = true; } diff --git a/protocols/ICQ-WIM/src/version.h b/protocols/ICQ-WIM/src/version.h index 3d6f84fa83..07aa40c64b 100644 --- a/protocols/ICQ-WIM/src/version.h +++ b/protocols/ICQ-WIM/src/version.h @@ -1,6 +1,6 @@ #define __MAJOR_VERSION 0 -#define __MINOR_VERSION 95 -#define __RELEASE_NUM 12 +#define __MINOR_VERSION 96 +#define __RELEASE_NUM 1 #define __BUILD_NUM 1 #include -- cgit v1.2.3