PronounDB: Fix crashing
This commit is contained in:
parent
b0e2f310bc
commit
409f47bf24
|
@ -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 {
|
||||
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.showSelf && id === UserStore.getCurrentUser()?.id) return EmptyPronouns;
|
||||
|
||||
return pronouns;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return EmptyPronouns;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue