Skip to content

Commit 409f47b

Browse files
committed
PronounDB: Fix crashing
1 parent b0e2f31 commit 409f47b

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/plugins/pronoundb/api.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import { getCurrentChannel } from "@utils/discord";
2020
import { useAwaiter } from "@utils/react";
2121
import { findStoreLazy } from "@webpack";
22-
import { UserProfileStore } from "@webpack/common";
22+
import { UserProfileStore, UserStore } from "@webpack/common";
2323

2424
import { settings } from "./settings";
2525
import { PronounMapping, Pronouns, PronounsCache, PronounSets, PronounsFormat, PronounSource, PronounsResponse } from "./types";
@@ -158,10 +158,15 @@ export function useFormattedPronouns(id: string, useGlobalProfile: boolean = fal
158158
}
159159

160160
export function useProfilePronouns(id: string, useGlobalProfile: boolean = false): Pronouns {
161-
const pronouns = useFormattedPronouns(id, useGlobalProfile);
161+
try {
162+
const pronouns = useFormattedPronouns(id, useGlobalProfile);
162163

163-
if (!settings.store.showInProfile) return EmptyPronouns;
164-
if (!settings.store.showSelf && id === UserProfileStore.getCurrentUser()?.id) return EmptyPronouns;
164+
if (!settings.store.showInProfile) return EmptyPronouns;
165+
if (!settings.store.showSelf && id === UserStore.getCurrentUser()?.id) return EmptyPronouns;
165166

166-
return pronouns;
167+
return pronouns;
168+
} catch (e) {
169+
console.error(e);
170+
return EmptyPronouns;
171+
}
167172
}

0 commit comments

Comments
 (0)