summaryrefslogtreecommitdiff
path: root/src/modules/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-10-31 19:48:52 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-10-31 19:48:52 +0000
commit18a2467e5aa21ccef3bc8a26f446ca583469ca76 (patch)
tree672c275a549006cce5125b96534f61ca004b7534 /src/modules/protocols
parentd490528e80606da1250a21986c040ab483abd9a2 (diff)
we don't wanna gather junk
git-svn-id: http://svn.miranda-ng.org/main/trunk@2125 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/protocols')
-rw-r--r--src/modules/protocols/protochains.cpp10
1 files changed, 6 insertions, 4 deletions
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;
}