From 2e44a9394e3c0ece41c765bec5b00339f36f8484 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 10 Dec 2024 15:51:48 +0300 Subject: fixes #4799 ([Discord] Most messages (even older ones before the bug?) seem to be marked with non-existant reply ID, causing all messages to look like replies) --- protocols/Discord/src/dispatch.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'protocols/Discord/src/dispatch.cpp') diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp index abcae9afb8..1d4209715f 100644 --- a/protocols/Discord/src/dispatch.cpp +++ b/protocols/Discord/src/dispatch.cpp @@ -521,10 +521,11 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot, bool bIsNew) if (userId == m_ownId) dbei.flags |= DBEF_READ | DBEF_SENT; - if (auto &nReply = pRoot["message_reference"]) { - _i64toa(::getId(nReply["message_id"]), szReplyId, 10); - dbei.szReplyId = szReplyId; - } + if (auto &nReply = pRoot["message_reference"]) + if (auto replyId = ::getId(nReply["message_id"])) { + _i64toa(replyId, szReplyId, 10); + dbei.szReplyId = szReplyId; + } debugLogA("store a message from private user %lld, channel id %lld", pUser->id, pUser->channelId); -- cgit v1.2.3