summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-03-15 21:44:43 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-03-15 21:44:43 +0000
commitc1954acb738dd7f41f2c67bfd5fa8d98c435fff1 (patch)
tree3ec77dde2487bab8b76ab39b34e8ad1683f7e7c0 /plugins/Dbx_mdb/src
parent15e6faa8bc73431220727ae2fe38515abe03f9cc (diff)
fix for processing NULL event handles
git-svn-id: http://svn.miranda-ng.org/main/trunk@12411 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src')
-rw-r--r--plugins/Dbx_mdb/src/dbevents.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp
index c0a507f5d3..d42975e698 100644
--- a/plugins/Dbx_mdb/src/dbevents.cpp
+++ b/plugins/Dbx_mdb/src/dbevents.cpp
@@ -247,6 +247,8 @@ void CDbxMdb::FindNextUnread(const txn_ptr &txn, DBCachedContact *cc, DBEventSor
STDMETHODIMP_(BOOL) CDbxMdb::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent)
{
+ if (hDbEvent == 0) return -1;
+
DBCachedContact *cc = m_cache->GetCachedContact(contactID);
if (cc == NULL)
return -1;
@@ -284,12 +286,14 @@ STDMETHODIMP_(BOOL) CDbxMdb::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent)
STDMETHODIMP_(MCONTACT) CDbxMdb::GetEventContact(MEVENT hDbEvent)
{
+ if (hDbEvent == 0) return INVALID_CONTACT_ID;
+
mir_cslock lck(m_csDbAccess);
txn_ptr txn(m_pMdbEnv, true);
MDB_val key = { sizeof(MEVENT), &hDbEvent }, data;
if (mdb_get(txn, m_dbEvents, &key, &data) != MDB_SUCCESS)
- return 0;
+ return INVALID_CONTACT_ID;
DBEvent *dbe = (DBEvent*)data.mv_data;
return (dbe->dwSignature == DBEVENT_SIGNATURE) ? dbe->contactID : INVALID_CONTACT_ID;
@@ -339,6 +343,8 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindLastEvent(MCONTACT contactID)
STDMETHODIMP_(MEVENT) CDbxMdb::FindNextEvent(MCONTACT contactID, MEVENT hDbEvent)
{
+ if (hDbEvent == 0) return m_evLast = 0;
+
MDB_val data;
DWORD ts;
@@ -370,6 +376,8 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindNextEvent(MCONTACT contactID, MEVENT hDbEvent
STDMETHODIMP_(MEVENT) CDbxMdb::FindPrevEvent(MCONTACT contactID, MEVENT hDbEvent)
{
+ if (hDbEvent == 0) return m_evLast = 0;
+
MDB_val data;
DWORD ts;