From e53cff573720acde3a88d73cb80a9fd74082b7ff Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 15 Sep 2024 19:14:34 +0100 Subject: [PATCH] Added nickname checking when bot lacks a nickname --- project/src/services/MatchBotDetailsCacheService.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/project/src/services/MatchBotDetailsCacheService.ts b/project/src/services/MatchBotDetailsCacheService.ts index 97eb4608..2dccc0d9 100644 --- a/project/src/services/MatchBotDetailsCacheService.ts +++ b/project/src/services/MatchBotDetailsCacheService.ts @@ -18,6 +18,12 @@ export class MatchBotDetailsCacheService { * @param botToCache Bot details to cache */ public cacheBot(botToCache: IBotBase): void { + if (!botToCache.Info.Nickname) { + this.logger.warning( + `Unable to cache: ${botToCache.Info.Settings.Role} bot with id: ${botToCache._id} as it lacks a nickname`, + ); + return; + } this.botDetailsCache[`${botToCache.Info.Nickname.trim()}${botToCache.Info.Side}`] = botToCache; }