diff --git a/source/game/StarPlayerStorage.cpp b/source/game/StarPlayerStorage.cpp index 843fc44..7e4b74b 100644 --- a/source/game/StarPlayerStorage.cpp +++ b/source/game/StarPlayerStorage.cpp @@ -272,11 +272,13 @@ Json PlayerStorage::getMetadata(String const& key) { return m_metadata.value(key); } -String const& PlayerStorage::uuidFileName(Uuid const& uuid) const { +String const& PlayerStorage::uuidFileName(Uuid const& uuid) { if (auto fileName = m_playerFileNames.rightPtr(uuid)) return *fileName; - else - throw PlayerException::format("No matching filename for uuid '{}'", uuid.hex()); + else { + m_playerFileNames.insert(uuid, uuid.hex()); + return *m_playerFileNames.rightPtr(uuid); + } } void PlayerStorage::writeMetadata() { diff --git a/source/game/StarPlayerStorage.hpp b/source/game/StarPlayerStorage.hpp index 807aa7f..ea67e94 100644 --- a/source/game/StarPlayerStorage.hpp +++ b/source/game/StarPlayerStorage.hpp @@ -44,7 +44,7 @@ public: Json getMetadata(String const& key); private: - String const& uuidFileName(Uuid const& uuid) const; + String const& uuidFileName(Uuid const& uuid); void writeMetadata(); mutable RecursiveMutex m_mutex;