summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2014-10-13 09:15:41 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2014-10-13 09:15:41 +0000
commit547ff12e0cf83fdef769fae8be1b9c3c4ecba332 (patch)
tree1bde2c0cabbbdbf84c1b03e574640963888bb600 /protocols/VKontakte
parent3a4aec44402f1d508703a473502f84d2eb6b03d2 (diff)
VKontakte: fix for crash on 'empty' chat message
git-svn-id: http://svn.miranda-ng.org/main/trunk@10774 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index 709b68f1cd..97323ca1a8 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -253,7 +253,7 @@ void CVkProto::AppendChatMessage(int id, JSONNODE *pMsg, bool bIsHistory)
void CVkProto::AppendChatMessage(CVkChatInfo *cc, int mid, int uid, int msgTime, LPCTSTR ptszBody, bool bIsHistory)
{
- debugLogA("CVkProto::AppendChatMessage param");
+ debugLogA("CVkProto::AppendChatMessage2");
CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&uid);
if (cu == NULL) {
cc->m_users.insert(cu = new CVkChatUser(uid));
@@ -263,6 +263,7 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int mid, int uid, int msgTime,
TCHAR tszId[20];
_itot(uid, tszId, 10);
+ CMString tszBody(ptszBody);
GCDEST gcd = { m_szModuleName, cc->m_tszId, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
@@ -270,8 +271,8 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int mid, int uid, int msgTime,
gce.ptszUID = tszId;
gce.time = msgTime;
gce.dwFlags = (bIsHistory) ? GCEF_NOTNOTIFY : GCEF_ADDTOLOG;
- gce.ptszNick = mir_tstrdup(cu->m_tszNick);
- gce.ptszText = mir_tstrdup(ptszBody);
+ gce.ptszNick = cu->m_tszNick ? mir_tstrdup(cu->m_tszNick) : mir_tstrdup(TranslateT("Unknown"));
+ gce.ptszText = tszBody.IsEmpty() ? mir_tstrdup(L"...") : mir_tstrdup(tszBody.GetBuffer());
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
}