From 6cd8c9bb8c3df4cf57b6b26aa9e6af653beeb227 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 30 May 2024 10:07:58 -0700 Subject: [PATCH] bot_data: Fix TypeScript noUncheckedIndexedAccess errors. Signed-off-by: Anders Kaseorg --- web/src/bot_data.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/bot_data.ts b/web/src/bot_data.ts index ccc094c87b..e85367dcdd 100644 --- a/web/src/bot_data.ts +++ b/web/src/bot_data.ts @@ -78,7 +78,11 @@ export function update(bot_id: number, bot_update: ServerUpdateBotData): void { // We currently only support one service per bot. const service = services.get(bot_id)![0]; - if (bot_update.services !== undefined && bot_update.services.length > 0) { + if ( + service !== undefined && + bot_update.services !== undefined && + bot_update.services.length > 0 + ) { Object.assign(service, services_schema.parse(bot_update.services)[0]); } }