summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft
diff options
context:
space:
mode:
authorasie <kontakt@asie.pl>2019-06-15 16:35:10 +0200
committerasie <kontakt@asie.pl>2019-06-15 16:36:13 +0200
commitd251097545a3dc4b26b00a3d050856e4cbe9b7ef (patch)
treeea014241426b5e430fff58441fff8899cbc57cb1 /api/logic/minecraft
parentc35dbd972ef5506cf49ff071f743da91d0b36d68 (diff)
downloadMultiMC-d251097545a3dc4b26b00a3d050856e4cbe9b7ef.tar
MultiMC-d251097545a3dc4b26b00a3d050856e4cbe9b7ef.tar.gz
MultiMC-d251097545a3dc4b26b00a3d050856e4cbe9b7ef.tar.lz
MultiMC-d251097545a3dc4b26b00a3d050856e4cbe9b7ef.tar.xz
MultiMC-d251097545a3dc4b26b00a3d050856e4cbe9b7ef.zip
fix author name parsing
Diffstat (limited to 'api/logic/minecraft')
-rw-r--r--api/logic/minecraft/Mod.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/api/logic/minecraft/Mod.cpp b/api/logic/minecraft/Mod.cpp
index e41c319f..6217c9d2 100644
--- a/api/logic/minecraft/Mod.cpp
+++ b/api/logic/minecraft/Mod.cpp
@@ -254,15 +254,18 @@ void Mod::ReadFabricModInfo(QByteArray contents)
if (schemaVersion >= 1)
{
QJsonArray authors = object.value("authors").toArray();
+ m_authors = "";
- if (authors.size() == 0)
- m_authors = "";
- else if (authors.size() >= 1)
+ for (int i = 0; i < authors.size(); i++)
{
- m_authors = authors.at(0).toObject().value("name").toString();
- for (int i = 1; i < authors.size(); i++)
- {
- m_authors += ", " + authors.at(i).toObject().value("name").toString();
+ QString author_name = authors.at(i).isObject()
+ ? authors.at(i).toObject().value("name").toString()
+ : authors.at(i).toString();
+
+ if (i > 0)
+ m_authors += ", " + author_name;
+ else {
+ m_authors += author_name;
}
}