catch error if profile doesnt exist

This commit is contained in:
Mister_Nebula 2021-10-25 16:35:16 +01:00
parent 8943dc76b5
commit 51149fc700

View File

@ -87,11 +87,19 @@ namespace QSB
private string GetPlayerName()
{
var profileManager = StandaloneProfileManager.SharedInstance;
profileManager.Initialize();
var profile = profileManager.GetValue<StandaloneProfileManager.ProfileData>("_currentProfile");
var profileName = profile.profileName;
return profileName;
try
{
var profileManager = StandaloneProfileManager.SharedInstance;
profileManager.Initialize();
var profile = profileManager._currentProfile;
var profileName = profile.profileName;
return profileName;
}
catch (Exception ex)
{
DebugLog.ToConsole($"Error - Exception when getting player name : {ex}", MessageType.Error);
return "Player";
}
}
private void SetupNetworkId(GameObject go, int assetId)