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

@ -243,7 +243,8 @@ void wxGameList::SetStyle(Style style, bool save)
g_config.Save(); g_config.Save();
} }
ApplyGameListColumnWidths(); if (style == Style::kList)
ApplyGameListColumnWidths();
} }
long wxGameList::GetStyleFlags(Style style) const long wxGameList::GetStyleFlags(Style style) const

View File

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

View File

@ -372,7 +372,9 @@ void TextureRelationViewerWindow::RefreshTextureList()
} }
} }
textureRelationListA->Thaw(); textureRelationListA->Thaw();
textureRelationListA->EnsureVisible(scrollPos + textureRelationListA->GetCountPerPage() - 1); long itemCount = textureRelationListA->GetItemCount();
if (itemCount > 0)
textureRelationListA->EnsureVisible(std::min<long>(itemCount - 1, scrollPos + textureRelationListA->GetCountPerPage() - 1));
} }
void TextureRelationViewerWindow::OnTextureListRightClick(wxMouseEvent& event) void TextureRelationViewerWindow::OnTextureListRightClick(wxMouseEvent& event)
@ -383,4 +385,4 @@ void TextureRelationViewerWindow::OnTextureListRightClick(wxMouseEvent& event)
void TextureRelationViewerWindow::Close() void TextureRelationViewerWindow::Close()
{ {
this->Destroy(); this->Destroy();
} }