diff options
author | George Hazan <george.hazan@gmail.com> | 2015-02-12 17:19:11 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-02-12 17:19:11 +0000 |
commit | 47d0d742d0ba7cac754a7b1765328fb33a14ffc0 (patch) | |
tree | f62b24ef94f19a06fce5e7260f858477e293a828 /protocols/WhatsApp/src/chat.cpp | |
parent | 07f9c668a8292fa0869faf80881956592bf5096f (diff) |
complex fix against NULL in nicks
git-svn-id: http://svn.miranda-ng.org/main/trunk@12097 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/chat.cpp')
-rw-r--r-- | protocols/WhatsApp/src/chat.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index d6c650ec9d..a5be1e9bac 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -327,11 +327,16 @@ WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &n TCHAR* WhatsAppProto::GetChatUserNick(const std::string &jid)
{
- if (m_szJid == jid)
- return str2t(m_szNick);
+ TCHAR* tszNick;
+ if (m_szJid != jid) {
+ MCONTACT hContact = ContactIDToHContact(jid);
+ tszNick = (hContact == 0) ? utils::removeA(str2t(jid)) : mir_tstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
+ }
+ else tszNick = str2t(m_szNick);
- MCONTACT hContact = ContactIDToHContact(jid);
- return (hContact == 0) ? utils::removeA(str2t(jid)) : mir_tstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
+ if (tszNick == NULL)
+ tszNick = mir_tstrdup(TranslateT("Unknown user"));
+ return tszNick;
}
WAChatInfo* WhatsAppProto::SafeGetChat(const std::string &jid)
|