Fix more UI asserts (#146)

This commit is contained in:
bitscher 2022-09-02 02:01:17 -07:00 committed by GitHub
parent 86e1a2227c
commit b1e92f1779
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View file

@ -73,7 +73,8 @@ void SymbolListCtrl::OnGameLoaded()
rplSymbolStorage_unlockSymbolMap();
SetItemCount(m_data.size());
RefreshItems(GetTopItem(), GetTopItem() + GetCountPerPage() + 1);
if (m_data.size() > 0)
RefreshItems(GetTopItem(), std::min<long>(m_data.size() - 1, GetTopItem() + GetCountPerPage() + 1));
}
wxString SymbolListCtrl::OnGetItemText(long item, long column) const
@ -159,5 +160,6 @@ void SymbolListCtrl::ChangeListFilter(std::string filter)
}
}
SetItemCount(visible_entries);
RefreshItems(GetTopItem(), GetTopItem() + GetCountPerPage() + 1);
if (visible_entries > 0)
RefreshItems(GetTopItem(), std::min<long>(visible_entries - 1, GetTopItem() + GetCountPerPage() + 1));
}