From 29b8923c5ba9df17bc65c3eaa120b38b4d355e16 Mon Sep 17 00:00:00 2001 From: Samuel Elliott Date: Fri, 23 Sep 2022 20:36:18 +0100 Subject: [PATCH] Prevent attempting to update SplatNet 3 data for presence if not configured How can this happen?? --- src/discord/titles/nintendo/splatoon3.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/discord/titles/nintendo/splatoon3.ts b/src/discord/titles/nintendo/splatoon3.ts index c82077a..d252882 100644 --- a/src/discord/titles/nintendo/splatoon3.ts +++ b/src/discord/titles/nintendo/splatoon3.ts @@ -97,6 +97,11 @@ export default class SplatNet3Monitor extends EmbeddedLoop { } async update() { + if (!this.config) { + debug('Not updating SplatNet 3 monitor - not configured'); + return this.disable(); + } + const friends = this.cached_friends ?? await this.splatnet?.getFriendsRefetch(); this.cached_friends = null; @@ -108,7 +113,7 @@ export default class SplatNet3Monitor extends EmbeddedLoop { this.regular_schedule = this.getSchedule(this.cached_schedules?.data.regularSchedules.nodes ?? []); if (!this.regular_schedule) { - this.cached_schedules = await this.splatnet!.getSchedules(); + this.cached_schedules = await this.splatnet?.getSchedules() ?? null; this.regular_schedule = this.getSchedule(this.cached_schedules?.data.regularSchedules.nodes ?? []); }