From e79e9e44d8d960d56938f5948dc6b2d77db5b87a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 22 Sep 2014 19:31:17 +0000 Subject: we don't allow to write resident settings for non-existent contacts git-svn-id: http://svn.miranda-ng.org/main/trunk@10559 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x_mmap/src/dbsettings.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index a73e89d640..fe6e12b592 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -458,6 +458,12 @@ LBL_WriteString: mir_cslockfull lck(m_csDbAccess); + DWORD ofsBlobPtr, ofsContact = GetContactOffset(contactID); + if (ofsContact == 0) { + _ASSERT(false); // contact doesn't exist? + return 2; + } + char *szCachedSettingName = m_cache->GetCachedSetting(dbcwWork.szModule, dbcwWork.szSetting, moduleNameLen, settingNameLen); log3("set [%08p] %s (%p)", hContact, szCachedSettingName, szCachedSettingName); @@ -491,7 +497,6 @@ LBL_WriteString: log1(" write database as %s", printVariant(&dbcwWork.value)); DWORD ofsModuleName = GetModuleNameOfs(dbcwWork.szModule); - DWORD ofsBlobPtr, ofsContact = GetContactOffset(contactID); DBContact dbc = *(DBContact*)DBRead(ofsContact, sizeof(DBContact), NULL); if (dbc.signature != DBCONTACT_SIGNATURE) return 1; -- cgit v1.2.3