From 18a2467e5aa21ccef3bc8a26f446ca583469ca76 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 31 Oct 2012 19:48:52 +0000 Subject: we don't wanna gather junk git-svn-id: http://svn.miranda-ng.org/main/trunk@2125 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/protocols/protochains.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/modules/protocols/protochains.cpp') diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp index 977ba9090c..3e86014fed 100644 --- a/src/modules/protocols/protochains.cpp +++ b/src/modules/protocols/protochains.cpp @@ -32,9 +32,7 @@ static int GetProtocolP(HANDLE hContact, char *szBuf, int cbLen) return 1; DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact); - if (cc == NULL) - cc = currDb->m_cache->AddContactToCache(hContact); - if (cc->szProto != NULL) { + if (cc && cc->szProto != NULL) { strncpy(szBuf, cc->szProto, cbLen); szBuf[cbLen-1] = 0; return 0; @@ -51,8 +49,12 @@ static int GetProtocolP(HANDLE hContact, char *szBuf, int cbLen) dbcgs.szSetting = "p"; int res = currDb->GetContactSettingStatic(hContact, &dbcgs); - if (res == 0 && !cc->szProto) + if (res == 0) { + if (cc == NULL) + cc = currDb->m_cache->AddContactToCache(hContact); + cc->szProto = currDb->m_cache->GetCachedSetting(NULL, szBuf, 0, strlen(szBuf)); + } return res; } -- cgit v1.2.3