summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-10 23:08:52 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-10 23:08:52 +0300
commit3f2515626d724fb748535020085e1822db113013 (patch)
tree8e90f8a548aff3aaf2a0015d3f2e61ec42e0c52f
parent60058a8cdad93ccf5a98e2ec3914a9a02525711d (diff)
merge from #1093: we don't check null pointers and missing subs
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp3
-rw-r--r--plugins/Clist_modern/src/modern_clistsettings.cpp2
-rw-r--r--src/mir_app/src/clistsettings.cpp10
3 files changed, 9 insertions, 6 deletions
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index d63ead4360..c60058c1bc 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -43,6 +43,9 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup)
int bHideOffline = db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT);
for (int j = 0; j < subcount; j++) {
MCONTACT hsub = db_mc_getSub(cont->hContact, j);
+ if (hsub == -1)
+ continue;
+
ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hsub);
WORD wStatus = pdnce->getStatus();
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp
index f964409947..4a692a154d 100644
--- a/plugins/Clist_modern/src/modern_clistsettings.cpp
+++ b/plugins/Clist_modern/src/modern_clistsettings.cpp
@@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-void InsertContactIntoTree(MCONTACT hContact, int status);
-
wchar_t* UnknownConctactTranslatedName = nullptr;
void cliFreeCacheItem(ClcCacheEntry *p)
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp
index f50d0ba4f4..3413fdc5f0 100644
--- a/src/mir_app/src/clistsettings.cpp
+++ b/src/mir_app/src/clistsettings.cpp
@@ -76,10 +76,12 @@ ClcCacheEntry* fnGetCacheEntry(MCONTACT hContact)
ClcCacheEntry *p;
int idx = clistCache.getIndex((ClcCacheEntry*)&hContact);
if (idx == -1) {
- if ((p = cli.pfnCreateCacheItem(hContact)) != nullptr) {
- clistCache.insert(p);
- cli.pfnInvalidateDisplayNameCacheEntry(hContact);
- }
+ p = cli.pfnCreateCacheItem(hContact);
+ if (p == nullptr)
+ return nullptr;
+
+ clistCache.insert(p);
+ cli.pfnInvalidateDisplayNameCacheEntry(hContact);
}
else p = clistCache[idx];