fix crash when no resorce version is available

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2024-10-08 22:02:38 +03:00
parent e2b346fc53
commit d31c947b36
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318

View File

@ -254,7 +254,10 @@ void ResourcePage::updateSelectionButton()
m_ui->resourceSelectionButton->setEnabled(true);
if (auto current_pack = getCurrentPack(); current_pack) {
if (!current_pack->isVersionSelected(m_selected_version_index))
if (current_pack->versionsLoaded && current_pack->versions.empty()) {
m_ui->resourceSelectionButton->setEnabled(false);
qWarning() << tr("No version available for the selected pack");
} else if (!current_pack->isVersionSelected(m_selected_version_index))
m_ui->resourceSelectionButton->setText(tr("Select %1 for download").arg(resourceString()));
else
m_ui->resourceSelectionButton->setText(tr("Deselect %1 for download").arg(resourceString()));