add extra protection against empty download link
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com> (cherry picked from commit 8daa1219a508ddb37070c01046c78b731a277887)
This commit is contained in:
parent
42190819ae
commit
3d55236fdf
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include "ResourcePage.h"
|
#include "ResourcePage.h"
|
||||||
#include "modplatform/ModIndex.h"
|
#include "modplatform/ModIndex.h"
|
||||||
|
#include "ui/dialogs/CustomMessageBox.h"
|
||||||
#include "ui_ResourcePage.h"
|
#include "ui_ResourcePage.h"
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
@ -324,9 +325,9 @@ void ResourcePage::onSelectionChanged(QModelIndex curr, [[maybe_unused]] QModelI
|
|||||||
updateUi();
|
updateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourcePage::onVersionSelectionChanged(int index)
|
void ResourcePage::onVersionSelectionChanged(int)
|
||||||
{
|
{
|
||||||
m_selected_version_index = index;
|
m_selected_version_index = m_ui->versionSelectionBox->currentData().toInt();
|
||||||
updateSelectionButton();
|
updateSelectionButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,10 +359,18 @@ void ResourcePage::onResourceSelected()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto current_pack = getCurrentPack();
|
auto current_pack = getCurrentPack();
|
||||||
if (!current_pack || !current_pack->versionsLoaded)
|
if (!current_pack || !current_pack->versionsLoaded || current_pack->versions.size() < m_selected_version_index)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto& version = current_pack->versions[m_selected_version_index];
|
auto& version = current_pack->versions[m_selected_version_index];
|
||||||
|
if (version.downloadUrl.isNull()) {
|
||||||
|
CustomMessageBox::selectable(this, tr("How?"),
|
||||||
|
"You managed to select a resource that doesn't have a download link. Because of this missing "
|
||||||
|
"information prism will not try to download it.",
|
||||||
|
QMessageBox::Warning)
|
||||||
|
->show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (version.is_currently_selected)
|
if (version.is_currently_selected)
|
||||||
removeResourceFromDialog(current_pack->name);
|
removeResourceFromDialog(current_pack->name);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user