summaryrefslogtreecommitdiffstats
path: root/api/logic/meta/VersionList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'api/logic/meta/VersionList.cpp')
-rw-r--r--api/logic/meta/VersionList.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/api/logic/meta/VersionList.cpp b/api/logic/meta/VersionList.cpp
index a12f5418..d6bbf70f 100644
--- a/api/logic/meta/VersionList.cpp
+++ b/api/logic/meta/VersionList.cpp
@@ -125,13 +125,15 @@ QString VersionList::humanReadable() const
return m_name.isEmpty() ? m_uid : m_name;
}
-bool VersionList::hasVersion(const QString &version) const
+VersionPtr VersionList::getVersion(const QString &version)
{
- return m_lookup.contains(version);
-}
-VersionPtr VersionList::getVersion(const QString &version) const
-{
- return m_lookup.value(version);
+ VersionPtr out = m_lookup.value(version, nullptr);
+ if(!out)
+ {
+ out = std::make_shared<Version>(m_uid, version);
+ m_lookup[version] = out;
+ }
+ return out;
}
void VersionList::setName(const QString &name)