From 254018800ee310d7b8eb3e17f1aea8e411fc7b28 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Fri, 18 Mar 2016 17:16:04 +0000 Subject: dbx_lmdb: potentiual crash fix git-svn-id: http://svn.miranda-ng.org/main/trunk@16503 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dbx_mdb/src/dbcontacts.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'plugins/Dbx_mdb/src/dbcontacts.cpp') diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp index 442e499d04..076890fe6d 100644 --- a/plugins/Dbx_mdb/src/dbcontacts.cpp +++ b/plugins/Dbx_mdb/src/dbcontacts.cpp @@ -116,16 +116,16 @@ STDMETHODIMP_(LONG) CDbxMdb::DeleteContact(MCONTACT contactID) key.mv_size = sizeof(keyS); key.mv_data = &keyS; - mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE); - - do + if (mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE)) { - const DBSettingKey *pKey = (const DBSettingKey*)key.mv_data; - if (pKey->dwContactID != contactID) - break; - mdb_cursor_del(cursor, 0); - } - while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS); + do + { + const DBSettingKey *pKey = (const DBSettingKey*)key.mv_data; + if (pKey->dwContactID != contactID) + break; + mdb_cursor_del(cursor, 0); + } while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS); + } txn.commit(); } -- cgit v1.2.3