diff --git a/src/online/online_player_profile.cpp b/src/online/online_player_profile.cpp index 611844d66..2a48ad42f 100644 --- a/src/online/online_player_profile.cpp +++ b/src/online/online_player_profile.cpp @@ -211,7 +211,7 @@ namespace Online int userid_fetched = input->get("userid", &userid); setLastOnlineName(username); - m_profile = new OnlineProfile(userid, username, true); + OnlineProfile* profile = new OnlineProfile(userid, username, true); assert(token_fetched && username_fetched && userid_fetched); m_online_state = OS_SIGNED_IN; if(rememberPassword()) @@ -219,7 +219,7 @@ namespace Online saveSession(getOnlineId(), getToken()); } - ProfileManager::get()->addPersistent(m_profile); + m_profile = ProfileManager::get()->addPersistent(profile); std::string achieved_string(""); // Even if no achievements were sent, we have to call sync diff --git a/src/online/profile_manager.cpp b/src/online/profile_manager.cpp index 156c6a54f..07583ba1f 100644 --- a/src/online/profile_manager.cpp +++ b/src/online/profile_manager.cpp @@ -253,7 +253,7 @@ bool ProfileManager::inPersistent(const uint32_t id) * the friends, while the other could have fetched the achievements.) * \param profile The profile to make persistent. */ -void ProfileManager::addPersistent(OnlineProfile * profile) +OnlineProfile* ProfileManager::addPersistent(OnlineProfile * profile) { if (inPersistent(profile->getID())) { @@ -263,6 +263,8 @@ void ProfileManager::addPersistent(OnlineProfile * profile) { m_profiles_persistent[profile->getID()] = profile; } + + return m_profiles_persistent[profile->getID()]; } // addPersistent // ------------------------------------------------------------------------ diff --git a/src/online/profile_manager.hpp b/src/online/profile_manager.hpp index 474f32bc4..9a81d4a2f 100644 --- a/src/online/profile_manager.hpp +++ b/src/online/profile_manager.hpp @@ -103,7 +103,7 @@ public: // ---------------------------------------------------------------- void addToCache(OnlineProfile *profile); - void addPersistent(OnlineProfile *profile); + OnlineProfile* addPersistent(OnlineProfile *profile); void deleteFromPersistent(const uint32_t id); void clearPersistent(); void moveToCache(const uint32_t id);