From 409f47bf2441b24ceac8fc0f2388490e1b10d69d Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:26:50 -0300 Subject: [PATCH] PronounDB: Fix crashing --- src/plugins/pronoundb/api.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/plugins/pronoundb/api.ts b/src/plugins/pronoundb/api.ts index da2bc651..22821796 100644 --- a/src/plugins/pronoundb/api.ts +++ b/src/plugins/pronoundb/api.ts @@ -19,7 +19,7 @@ import { getCurrentChannel } from "@utils/discord"; import { useAwaiter } from "@utils/react"; import { findStoreLazy } from "@webpack"; -import { UserProfileStore } from "@webpack/common"; +import { UserProfileStore, UserStore } from "@webpack/common"; import { settings } from "./settings"; import { PronounMapping, Pronouns, PronounsCache, PronounSets, PronounsFormat, PronounSource, PronounsResponse } from "./types"; @@ -158,10 +158,15 @@ export function useFormattedPronouns(id: string, useGlobalProfile: boolean = fal } export function useProfilePronouns(id: string, useGlobalProfile: boolean = false): Pronouns { - const pronouns = useFormattedPronouns(id, useGlobalProfile); + try { + const pronouns = useFormattedPronouns(id, useGlobalProfile); - if (!settings.store.showInProfile) return EmptyPronouns; - if (!settings.store.showSelf && id === UserProfileStore.getCurrentUser()?.id) return EmptyPronouns; + if (!settings.store.showInProfile) return EmptyPronouns; + if (!settings.store.showSelf && id === UserStore.getCurrentUser()?.id) return EmptyPronouns; - return pronouns; + return pronouns; + } catch (e) { + console.error(e); + return EmptyPronouns; + } }