diff options
author | George Hazan <george.hazan@gmail.com> | 2016-05-19 16:10:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-05-19 16:10:42 +0000 |
commit | da12f9bb9e52a66915c9506c11b74967d94e2ece (patch) | |
tree | 13ad29a31ace99a1e939cfb85dea4ceddb6cd414 /src | |
parent | 65f3c2b16152a7aaf4f4e6de6f59b204a91abca6 (diff) |
we don't try to cache NULL contact
git-svn-id: http://svn.miranda-ng.org/main/trunk@16854 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/clistsettings.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/contacts.cpp | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp index 54d36ca38f..0e245c4d63 100644 --- a/src/mir_app/src/clistsettings.cpp +++ b/src/mir_app/src/clistsettings.cpp @@ -41,6 +41,9 @@ void FreeDisplayNameCache(void) ClcCacheEntry* fnCreateCacheItem(MCONTACT hContact)
{
+ if (hContact == NULL)
+ return NULL;
+
ClcCacheEntry *p = (ClcCacheEntry*)mir_calloc(sizeof(ClcCacheEntry));
if (p == NULL)
return NULL;
@@ -99,8 +102,10 @@ void fnInvalidateDisplayNameCacheEntry(MCONTACT hContact) TCHAR* fnGetContactDisplayName(MCONTACT hContact, int mode)
{
+ if (hContact == NULL)
+ return TranslateT("(Unknown contact)");
+
ClcCacheEntry *cacheEntry = NULL;
-
if (mode & GCDNF_NOCACHE)
mode &= ~GCDNF_NOCACHE;
else if (mode != GCDNF_NOMYHANDLE) {
@@ -117,6 +122,7 @@ TCHAR* fnGetContactDisplayName(MCONTACT hContact, int mode) }
CallContactService(hContact, PSS_GETINFO, SGIF_MINIMAL, 0);
+
TCHAR *buffer = TranslateT("(Unknown contact)");
return (cacheEntry == NULL) ? mir_tstrdup(buffer) : buffer;
}
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index e2c679dcc3..5e6a6bc52b 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -87,6 +87,9 @@ static TCHAR* ProcessDatabaseValueDefault(MCONTACT hContact, const char *szProto MIR_APP_DLL(TCHAR*) Contact_GetInfo(int type, MCONTACT hContact, const char *szProto)
{
+ if (hContact == NULL && szProto == NULL)
+ return NULL;
+
if (szProto == NULL)
szProto = Proto_GetBaseAccountName(hContact);
if (szProto == NULL)
|