From 42b3d7abc3e15c78001c6d672f34b24de9d5fb2d Mon Sep 17 00:00:00 2001 From: Chomp Date: Sun, 15 Dec 2024 17:06:20 +0000 Subject: [PATCH] Added nullguard protection to `getFriends()` --- project/src/controllers/ProfileController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/src/controllers/ProfileController.ts b/project/src/controllers/ProfileController.ts index fed218c2..cfa1007d 100644 --- a/project/src/controllers/ProfileController.ts +++ b/project/src/controllers/ProfileController.ts @@ -368,9 +368,9 @@ export class ProfileController { const allProfiles = Object.values(this.saveServer.getProfiles()); for (const profile of allProfiles) { - const pmcProfile = profile.characters.pmc; + const pmcProfile = profile?.characters?.pmc; - if (!pmcProfile.Info.LowerNickname.includes(info.nickname.toLocaleLowerCase())) { + if (!pmcProfile?.Info?.LowerNickname?.includes(info.nickname.toLocaleLowerCase())) { continue; }