From 053eae7ce2b585aebed1edd13ff7a039032da1f0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 8 Nov 2019 12:31:10 +0300 Subject: fixes #2120 ([Discord] If you already have a custom status, setting it again causes a crash) --- protocols/Discord/src/proto.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'protocols/Discord/src') diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index b8948afe17..72dca1ff6a 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -448,9 +448,9 @@ int CDiscordProto::SetAwayMsg(int iStatus, const wchar_t *msg) if (!mir_wstrcmp(msg, pwszMessage)) return 0; - pwszMessage = mir_wstrdup(msg); + replaceStrW(pwszMessage, msg); - JSONNode status; status.set_name("custom_status"); status << WCHAR_PARAM("text", msg); + JSONNode status; status.set_name("custom_status"); status << WCHAR_PARAM("text", (msg) ? msg : L""); JSONNode root; root << status; Push(new AsyncHttpRequest(this, REQUEST_PATCH, "/users/@me/settings", nullptr, &root)); return 0; -- cgit v1.2.3