Fix asserts in TitleManager and DownloadManager (#134)

This commit is contained in:
bitscher 2022-09-01 09:24:07 -07:00 committed by GitHub
parent d8da8a54a6
commit b8d4cf5b29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -629,7 +629,13 @@ void wxDownloadManagerList::SortEntries()
RefreshPage(); RefreshPage();
} }
void wxDownloadManagerList::RefreshPage() { RefreshItems(GetTopItem(), GetTopItem() + GetCountPerPage() + 1); } void wxDownloadManagerList::RefreshPage()
{
long item_count = GetItemCount();
if (item_count > 0)
RefreshItems(GetTopItem(), std::min(item_count - 1, GetTopItem() + GetCountPerPage() + 1));
}
int wxDownloadManagerList::Filter(const wxString& filter, const wxString& prefix, ItemColumn column) int wxDownloadManagerList::Filter(const wxString& filter, const wxString& prefix, ItemColumn column)
{ {

View File

@ -1170,7 +1170,13 @@ void wxTitleManagerList::SortEntries(int column)
RefreshPage(); RefreshPage();
} }
void wxTitleManagerList::RefreshPage() { RefreshItems(GetTopItem(), GetTopItem() + GetCountPerPage() + 1); } void wxTitleManagerList::RefreshPage()
{
long item_count = GetItemCount();
if (item_count > 0)
RefreshItems(GetTopItem(), std::min(item_count - 1, GetTopItem() + GetCountPerPage() + 1));
}
int wxTitleManagerList::Filter(const wxString& filter, const wxString& prefix, ItemColumn column) int wxTitleManagerList::Filter(const wxString& filter, const wxString& prefix, ItemColumn column)
{ {