Merge pull request #1350 from Trial97/fix_managed_pack_crash
fixed crash if no version is loaded on managed page
This commit is contained in:
parent
a0ddd85b32
commit
b11b86e026
@ -69,7 +69,6 @@ class NoBigComboBoxStyle : public QProxyStyle {
|
||||
|
||||
private:
|
||||
NoBigComboBoxStyle(QStyle* style) : QProxyStyle(style) {}
|
||||
|
||||
};
|
||||
|
||||
ManagedPackPage* ManagedPackPage::createPage(BaseInstance* inst, QString type, QWidget* parent)
|
||||
@ -226,7 +225,8 @@ void ModrinthManagedPackPage::parseManagedPack()
|
||||
|
||||
QString id = m_inst->getManagedPackID();
|
||||
|
||||
m_fetch_job->addNetAction(Net::Download::makeByteArray(QString("%1/project/%2/version").arg(BuildConfig.MODRINTH_PROD_URL, id), response));
|
||||
m_fetch_job->addNetAction(
|
||||
Net::Download::makeByteArray(QString("%1/project/%2/version").arg(BuildConfig.MODRINTH_PROD_URL, id), response));
|
||||
|
||||
QObject::connect(m_fetch_job.get(), &NetJob::succeeded, this, [this, response, id] {
|
||||
QJsonParseError parse_error{};
|
||||
@ -267,7 +267,6 @@ void ModrinthManagedPackPage::parseManagedPack()
|
||||
if (version.version == m_inst->getManagedPackVersionName())
|
||||
name = tr("%1 (Current)").arg(name);
|
||||
|
||||
|
||||
ui->versionsComboBox->addItem(name, QVariant(version.id));
|
||||
}
|
||||
|
||||
@ -291,6 +290,10 @@ QString ModrinthManagedPackPage::url() const
|
||||
void ModrinthManagedPackPage::suggestVersion()
|
||||
{
|
||||
auto index = ui->versionsComboBox->currentIndex();
|
||||
if (m_pack.versions.length() == 0) {
|
||||
setFailState();
|
||||
return;
|
||||
}
|
||||
auto version = m_pack.versions.at(index);
|
||||
|
||||
ui->changelogTextBrowser->setHtml(markdownToHTML(version.changelog.toUtf8()));
|
||||
@ -301,6 +304,10 @@ void ModrinthManagedPackPage::suggestVersion()
|
||||
void ModrinthManagedPackPage::update()
|
||||
{
|
||||
auto index = ui->versionsComboBox->currentIndex();
|
||||
if (m_pack.versions.length() == 0) {
|
||||
setFailState();
|
||||
return;
|
||||
}
|
||||
auto version = m_pack.versions.at(index);
|
||||
|
||||
QMap<QString, QString> extra_info;
|
||||
@ -429,6 +436,10 @@ QString FlameManagedPackPage::url() const
|
||||
void FlameManagedPackPage::suggestVersion()
|
||||
{
|
||||
auto index = ui->versionsComboBox->currentIndex();
|
||||
if (m_pack.versions.length() == 0) {
|
||||
setFailState();
|
||||
return;
|
||||
}
|
||||
auto version = m_pack.versions.at(index);
|
||||
|
||||
ui->changelogTextBrowser->setHtml(m_api.getModFileChangelog(m_inst->getManagedPackID().toInt(), version.fileId));
|
||||
@ -439,6 +450,10 @@ void FlameManagedPackPage::suggestVersion()
|
||||
void FlameManagedPackPage::update()
|
||||
{
|
||||
auto index = ui->versionsComboBox->currentIndex();
|
||||
if (m_pack.versions.length() == 0) {
|
||||
setFailState();
|
||||
return;
|
||||
}
|
||||
auto version = m_pack.versions.at(index);
|
||||
|
||||
QMap<QString, QString> extra_info;
|
||||
|
Loading…
Reference in New Issue
Block a user