diff options
Diffstat (limited to 'plugins/Dbx_mdb/src/dbevents.cpp')
-rw-r--r-- | plugins/Dbx_mdb/src/dbevents.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp index d8ea2607a2..2e22931c47 100644 --- a/plugins/Dbx_mdb/src/dbevents.cpp +++ b/plugins/Dbx_mdb/src/dbevents.cpp @@ -249,15 +249,18 @@ void CDbxMdb::FindNextUnread(const txn_ptr &txn, DBCachedContact *cc, DBEventSor MDB_val key = { sizeof(key2), &key2 }, data;
//key2.dwEventId++;
- mdb_cursor_get(cursor, &key, &data, MDB_SET);
- while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0) {
- DBEvent *dbe = (DBEvent*)data.mv_data;
- if (dbe->contactID != cc->contactID)
- break;
- if (!dbe->markedRead()) {
- cc->dbc.dwFirstUnread = key2.dwEventId;
- cc->dbc.tsFirstUnread = key2.ts;
- return;
+ if (mdb_cursor_get(cursor, &key, &data, MDB_SET) == MDB_SUCCESS)
+ {
+ while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS)
+ {
+ DBEvent *dbe = (DBEvent*)data.mv_data;
+ if (dbe->contactID != cc->contactID)
+ break;
+ if (!dbe->markedRead()) {
+ cc->dbc.dwFirstUnread = key2.dwEventId;
+ cc->dbc.tsFirstUnread = key2.ts;
+ return;
+ }
}
}
|