summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-09-17 16:42:38 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-09-17 16:42:43 +0300
commit41e677d44f0efc241bf484252af6de64b0d00a6c (patch)
tree58fb70a7dbcf07c6889ed898656c2293d11c49f4 /protocols
parent36825f68cad12f608b8ae7d1fe181dfb0b767c4a (diff)
ICQ: fix for occasional crash
Diffstat (limited to 'protocols')
-rw-r--r--protocols/ICQ-WIM/src/server.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index 74c5265389..8bb416a2c2 100644
--- a/protocols/ICQ-WIM/src/server.cpp
+++ b/protocols/ICQ-WIM/src/server.cpp
@@ -1164,7 +1164,7 @@ void CIcqProto::OnSearchResults(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pRe
void CIcqProto::OnSendMessage(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq)
{
- IcqOwnMessage *ownMsg = (IcqOwnMessage*)pReq->pUserInfo;
+ IcqOwnMessage *ownMsg = (IcqOwnMessage *)pReq->pUserInfo;
JsonReply root(pReply);
if (root.error() != 200) {
@@ -1178,9 +1178,12 @@ void CIcqProto::OnSendMessage(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq)
CallService(MS_MESSAGESTATE_UPDATE, ownMsg->m_hContact, MRD_TYPE_DELIVERED);
const JSONNode &data = root.data();
- CMStringA reqId(root.requestId());
- CMStringA msgId(data["histMsgId"].as_mstring());
- CheckOwnMessage(reqId, msgId, false);
+ if (auto &jsonMsg = data["histMsgId"]) {
+ CMStringA reqId(root.requestId());
+ CMStringA msgId(jsonMsg.as_mstring());
+ CheckOwnMessage(reqId, msgId, false);
+ }
+
CheckLastId(ownMsg->m_hContact, data);
}