Added nullguard to getMiniProfile() when profile has been edited and is now corrupt

This commit is contained in:
Dev 2024-06-18 11:27:57 +01:00
parent 5d0cfd7971
commit d15150f138

View File

@ -75,6 +75,11 @@ export class ProfileController
public getMiniProfile(sessionID: string): IMiniProfile
{
const profile = this.saveServer.getProfile(sessionID);
if (!profile || !profile.characters)
{
throw new Error(`Unable to find character data for id: ${sessionID}. Profile may be corrupt`);
}
const pmc = profile.characters.pmc;
const maxlvl = this.profileHelper.getMaxLevel();