summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_array.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/NewStory/src/history_array.cpp')
-rw-r--r--plugins/NewStory/src/history_array.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index 07d29edb85..dfa1da0064 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -248,13 +248,16 @@ bool HistoryArray::addEvent(MCONTACT hContact, MEVENT hEvent, int count)
int numItems = getCount();
auto *pPrev = (numItems == 0) ? nullptr : get(numItems - 1);
- for (int i = 0; hEvent && i < count; i++) {
+ DB::ECPTR pCursor(DB::Events(hContact, hEvent));
+ for (int i = 0; i < count; i++) {
+ hEvent = pCursor.FetchNext();
+ if (!hEvent)
+ break;
+
auto &p = allocateItem();
p.hContact = hContact;
p.hEvent = hEvent;
p.pPrev = pPrev; pPrev = &p;
-
- hEvent = db_event_next(hContact, hEvent);
}
return true;