PronounDB: Fix crash
This commit is contained in:
parent
088a8bd1b6
commit
e12c0e546c
|
@ -66,14 +66,14 @@ export function useFormattedPronouns(id: string): string | null {
|
||||||
// Discord is so stupid you can put tons of newlines in pronouns
|
// Discord is so stupid you can put tons of newlines in pronouns
|
||||||
const discordPronouns = getDiscordPronouns(id)?.trim().replace(NewLineRe, " ");
|
const discordPronouns = getDiscordPronouns(id)?.trim().replace(NewLineRe, " ");
|
||||||
|
|
||||||
if (settings.store.pronounSource === PronounSource.PreferDiscord && discordPronouns)
|
|
||||||
return discordPronouns;
|
|
||||||
|
|
||||||
const [result] = useAwaiter(() => fetchPronouns(id), {
|
const [result] = useAwaiter(() => fetchPronouns(id), {
|
||||||
fallbackValue: getCachedPronouns(id),
|
fallbackValue: getCachedPronouns(id),
|
||||||
onError: e => console.error("Fetching pronouns failed: ", e)
|
onError: e => console.error("Fetching pronouns failed: ", e)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (settings.store.pronounSource === PronounSource.PreferDiscord && discordPronouns)
|
||||||
|
return discordPronouns;
|
||||||
|
|
||||||
if (result && result !== "unspecified")
|
if (result && result !== "unspecified")
|
||||||
return formatPronouns(result);
|
return formatPronouns(result);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue