summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/NewStory/src/history_control.cpp3
-rw-r--r--plugins/NewStory/src/history_dlg.cpp10
2 files changed, 9 insertions, 4 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 441eda90fd..d8c6c4d213 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -121,6 +121,9 @@ static void __cdecl sttLoadItems(void *param)
auto *pData = (NewstoryListData *)param;
for (int i = pData->totalCount-1; i >= 0; i--) {
auto *pItem = pData->LoadItem(i, true);
+ if (!pItem)
+ break;
+
switch (pItem->dbe.eventType) {
case EVENTTYPE_FILE:
if (!pItem->m_bOfflineFile)
diff --git a/plugins/NewStory/src/history_dlg.cpp b/plugins/NewStory/src/history_dlg.cpp
index 2f9c80fba4..3a60ea0766 100644
--- a/plugins/NewStory/src/history_dlg.cpp
+++ b/plugins/NewStory/src/history_dlg.cpp
@@ -339,12 +339,14 @@ class CHistoryDlg : public CDlgBase
else {
ImageList_ReplaceIcon(hBookmarksIcons, -1, g_plugin.getIcon(IDI_BOOKMARK));
- auto &pArray = m_histCtrl->items;
- int numItems = pArray.getCount();
- for (int i = 0; i < numItems; i++)
- if (auto *pItem = pArray.get(i, true))
+ int numItems = m_histCtrl->totalCount;
+
+ for (int i = 0; i < numItems; i++) {
+ auto *pItem = m_histCtrl->GetItem(i);
+ if (pItem->fetch())
if (pItem->dbe.flags & DBEF_BOOKMARK)
m_bookmarks.AddItem(pItem->wtext, 0, i);
+ }
}
}