aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform
diff options
context:
space:
mode:
authortimoreo <timo.oreo34@gmail.com>2022-05-20 22:06:36 +0200
committertimoreo <timo.oreo34@gmail.com>2022-05-20 22:06:36 +0200
commit6542f5f15af31e493c9b46afb3a5b4b330cc9cee (patch)
tree9f90edefb60acbf32ea8097f4ef9a64bae2b588b /launcher/modplatform
parent30b56dbcbd3bb7d61210405a469c7efb28581904 (diff)
downloadPrismLauncher-6542f5f15af31e493c9b46afb3a5b4b330cc9cee.tar.gz
PrismLauncher-6542f5f15af31e493c9b46afb3a5b4b330cc9cee.tar.bz2
PrismLauncher-6542f5f15af31e493c9b46afb3a5b4b330cc9cee.zip
Apply suggestions
Diffstat (limited to 'launcher/modplatform')
-rw-r--r--launcher/modplatform/flame/PackManifest.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/launcher/modplatform/flame/PackManifest.cpp b/launcher/modplatform/flame/PackManifest.cpp
index c78783a0..3217a756 100644
--- a/launcher/modplatform/flame/PackManifest.cpp
+++ b/launcher/modplatform/flame/PackManifest.cpp
@@ -82,12 +82,13 @@ bool Flame::File::parseFromBytes(const QByteArray& bytes)
// this is probably a mod, dunno what else could modpacks download
targetFolder = "mods";
}
- if(!obj.contains("downloadUrl") || obj["downloadUrl"].isNull() || !obj["downloadUrl"].isString() || obj["downloadUrl"].toString().isEmpty()){
+ QString rawUrl = Json::ensureString(obj, "downloadUrl");
+
+ if(rawUrl.isEmpty()){
//either there somehow is an emtpy string as a link, or it's null either way it's invalid
//soft failing
return false;
}
- QString rawUrl = Json::requireString(obj, "downloadUrl");
url = QUrl(rawUrl, QUrl::TolerantMode);
if (!url.isValid()) {
throw JSONValidationError(QString("Invalid URL: %1").arg(rawUrl));