From d4164d05c3e84b43735c6bb0de678cb2031b248e Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 14 Jul 2024 17:21:12 +0100 Subject: [PATCH] Added null protection around `RagfairInfo` on game start --- project/src/controllers/GameController.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/project/src/controllers/GameController.ts b/project/src/controllers/GameController.ts index aad79fe5..89b37a1b 100644 --- a/project/src/controllers/GameController.ts +++ b/project/src/controllers/GameController.ts @@ -152,6 +152,15 @@ export class GameController return; } + if (fullProfile.characters.pmc.RagfairInfo) + { + if (Number.isNaN(fullProfile.characters.pmc.RagfairInfo.rating)) + { + this.logger.warning(`Profile: ${sessionID} ragfair rating was not a valid number, resetting to 0`); + fullProfile.characters.pmc.RagfairInfo.rating = 0; + } + } + const pmcProfile = fullProfile.characters.pmc; this.logger.debug(`Started game with sessionId: ${sessionID} ${pmcProfile.Info?.Nickname}`);