Added nullguards insode addPlayer()
to prevent server errors when profile not found or inraid
object not found
This commit is contained in:
parent
e2f3191212
commit
34466735ef
@ -96,7 +96,21 @@ export class InraidController
|
||||
public addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void
|
||||
{
|
||||
this.applicationContext.addValue(ContextVariableType.REGISTER_PLAYER_REQUEST, info);
|
||||
this.saveServer.getProfile(sessionID).inraid.location = info.locationId;
|
||||
const profile = this.saveServer.getProfile(sessionID);
|
||||
if (!profile)
|
||||
{
|
||||
this.logger.error(`No profile found with Id of: ${sessionID}`);
|
||||
|
||||
return;
|
||||
}
|
||||
if (!profile.inraid)
|
||||
{
|
||||
profile.inraid = { character: sessionID, location: info.locationId };
|
||||
}
|
||||
else
|
||||
{
|
||||
profile.inraid.location;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user