diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-03-19 02:13:49 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-04-07 00:20:02 +0200 |
commit | 2660418d58efb33cd3a0ab8ed9d48c359c076905 (patch) | |
tree | 0f947fea5c1dc59a2db83bab85e3fecbc19e4c5c /api/logic/meta/Index.cpp | |
parent | e46aba9da584338db8d8a1a8a487bdcc6cf84343 (diff) | |
download | MultiMC-2660418d58efb33cd3a0ab8ed9d48c359c076905.tar MultiMC-2660418d58efb33cd3a0ab8ed9d48c359c076905.tar.gz MultiMC-2660418d58efb33cd3a0ab8ed9d48c359c076905.tar.lz MultiMC-2660418d58efb33cd3a0ab8ed9d48c359c076905.tar.xz MultiMC-2660418d58efb33cd3a0ab8ed9d48c359c076905.zip |
NOISSUE hack it together enough to get launching back
Meta index will now always return valid objects.
They just might never load if they don't exist on the server.
Diffstat (limited to 'api/logic/meta/Index.cpp')
-rw-r--r-- | api/logic/meta/Index.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/api/logic/meta/Index.cpp b/api/logic/meta/Index.cpp index 35b9fb6f..0749651a 100644 --- a/api/logic/meta/Index.cpp +++ b/api/logic/meta/Index.cpp @@ -83,17 +83,19 @@ bool Index::hasUid(const QString &uid) const VersionListPtr Index::get(const QString &uid) { - return m_uids.value(uid, nullptr); + VersionListPtr out = m_uids.value(uid, nullptr); + if(!out) + { + out = std::make_shared<VersionList>(uid); + m_uids[uid] = out; + } + return out; } VersionPtr Index::get(const QString &uid, const QString &version) { auto list = get(uid); - if(list) - { - return list->getVersion(version); - } - return nullptr; + return list->getVersion(version); } void Index::parse(const QJsonObject& obj) |