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
b8b72e593d
@ -96,7 +96,21 @@ export class InraidController
|
|||||||
public addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void
|
public addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void
|
||||||
{
|
{
|
||||||
this.applicationContext.addValue(ContextVariableType.REGISTER_PLAYER_REQUEST, info);
|
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 };
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
profile.inraid.location;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user