1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-04 23:17:41 +02:00

Merge pull request #4297 from Alexander-Wilms/mod-assertion

CModListView::loadScreenshots(): Ensure a mod is selected in allModsView
This commit is contained in:
Ivan Savenko 2024-07-19 15:44:30 +03:00 committed by GitHub
commit 1cbfa43b6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -962,6 +962,12 @@ void CModListView::loadScreenshots()
{
if(ui->tabWidget->currentIndex() == 2)
{
if(!ui->allModsView->currentIndex().isValid())
{
// select the first mod, so we can access its data
ui->allModsView->setCurrentIndex(filterModel->index(0, 0));
}
ui->screenshotsList->clear();
QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString();
assert(modModel->hasMod(modName)); //should be filtered out by check above