summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-03-17 14:14:08 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-03-17 14:14:08 +0000
commitc54166b343d1bccb95e9e66858b11e789298dc7b (patch)
tree7e02126e0cade4a9a4659ca62239070ab275cf1d /plugins/Dbx_mdb
parentcf0b0b736cea27c86850a8b3485bc200bddb35ca (diff)
dbx_lmdb: crash fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@16489 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb')
-rw-r--r--plugins/Dbx_mdb/src/dbintf.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/Dbx_mdb/src/dbintf.cpp b/plugins/Dbx_mdb/src/dbintf.cpp
index 521a317b79..acf6645b5b 100644
--- a/plugins/Dbx_mdb/src/dbintf.cpp
+++ b/plugins/Dbx_mdb/src/dbintf.cpp
@@ -126,16 +126,16 @@ int CDbxMdb::Load(bool bSkipInit)
mdb_txn_begin(m_pMdbEnv, nullptr, MDB_RDONLY, &m_txn);
mdb_cursor_open(m_txn, m_dbEvents, &m_curEvents);
- mdb_cursor_get(m_curEvents, &key, &val, MDB_LAST);
- m_dwMaxEventId = *(MEVENT*)key.mv_data + 1;
+ if (mdb_cursor_get(m_curEvents, &key, &val, MDB_LAST) == MDB_SUCCESS)
+ m_dwMaxEventId = *(MEVENT*)key.mv_data + 1;
mdb_cursor_open(m_txn, m_dbEventsSort, &m_curEventsSort);
mdb_cursor_open(m_txn, m_dbSettings, &m_curSettings);
mdb_cursor_open(m_txn, m_dbModules, &m_curModules);
mdb_cursor_open(m_txn, m_dbContacts, &m_curContacts);
- mdb_cursor_get(m_curContacts, &key, &val, MDB_LAST);
- m_dwMaxContactId = *(DWORD*)key.mv_data + 1;
+ if (mdb_cursor_get(m_curContacts, &key, &val, MDB_LAST))
+ m_dwMaxContactId = *(DWORD*)key.mv_data + 1;
mdb_txn_reset(m_txn);
}