Fix #2270 (crash on startup).

This commit is contained in:
hiker
2015-08-14 16:50:37 +10:00
parent ce17da98bf
commit fa1ed0240f

View File

@@ -212,6 +212,10 @@ namespace Online
setLastOnlineName(username);
OnlineProfile* profile = new OnlineProfile(userid, username, true);
// Note that addPersistent might decide to merge profile with an
// existing profile, and then delete profile. Only the returned
// pointer is save to use.
m_profile = ProfileManager::get()->addPersistent(profile);
assert(token_fetched && username_fetched && userid_fetched);
m_online_state = OS_SIGNED_IN;
if(rememberPassword())
@@ -219,7 +223,6 @@ namespace Online
saveSession(getOnlineId(), getToken());
}
m_profile = ProfileManager::get()->addPersistent(profile);
std::string achieved_string("");
// Even if no achievements were sent, we have to call sync