diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2022-04-19 21:47:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-19 21:47:05 +0200 |
commit | 3ff3c335bcdc7a6037881a7b74f596d8de4b21ba (patch) | |
tree | 8c111203ca314e7fcd9522f78899b1a0d9af5535 /launcher/ui | |
parent | b9d5e1bbf199a5cb8f6bd748a74e415eb08d0691 (diff) | |
parent | ac77997a7afbdd6420232109c213e47ee5b0dc24 (diff) | |
download | PrismLauncher-3ff3c335bcdc7a6037881a7b74f596d8de4b21ba.tar.gz PrismLauncher-3ff3c335bcdc7a6037881a7b74f596d8de4b21ba.tar.bz2 PrismLauncher-3ff3c335bcdc7a6037881a7b74f596d8de4b21ba.zip |
Merge pull request #452 from Scrumplex/fix-download-mods-crash
Diffstat (limited to 'launcher/ui')
-rw-r--r-- | launcher/ui/pages/modplatform/ModModel.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/launcher/ui/pages/modplatform/ModModel.cpp b/launcher/ui/pages/modplatform/ModModel.cpp index da0331b5..e82e1cdb 100644 --- a/launcher/ui/pages/modplatform/ModModel.cpp +++ b/launcher/ui/pages/modplatform/ModModel.cpp @@ -192,13 +192,14 @@ void ListModel::searchRequestFinished(QJsonDocument& doc) void ListModel::searchRequestFailed(QString reason) { - if (jobPtr->first()->m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 409) { + if (!jobPtr->first()->m_reply) { + // Network error + QMessageBox::critical(nullptr, tr("Error"), tr("A network error occurred. Could not load mods.")); + } else if (jobPtr->first()->m_reply && jobPtr->first()->m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 409) { // 409 Gone, notify user to update QMessageBox::critical(nullptr, tr("Error"), //: %1 refers to the launcher itself QString("%1 %2").arg(m_parent->displayName()).arg(tr("API version too old!\nPlease update %1!").arg(BuildConfig.LAUNCHER_NAME))); - // self-destruct - (dynamic_cast<ModDownloadDialog*>((dynamic_cast<ModPage*>(parent()))->parentWidget()))->reject(); } jobPtr.reset(); |