Decor: Prevent crashing from useUserDecorAvatarDecoration
This commit is contained in:
parent
0cb84cee83
commit
1fe7912ec1
|
@ -95,6 +95,7 @@ export const useUsersDecorationsStore = proxyLazy(() => zustandCreate((set: any,
|
|||
} as UsersDecorationsState)));
|
||||
|
||||
export function useUserDecorAvatarDecoration(user?: User): AvatarDecoration | null | undefined {
|
||||
try {
|
||||
const [decorAvatarDecoration, setDecorAvatarDecoration] = useState<string | null>(user ? useUsersDecorationsStore.getState().getAsset(user.id) ?? null : null);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -115,4 +116,9 @@ export function useUserDecorAvatarDecoration(user?: User): AvatarDecoration | nu
|
|||
}, []);
|
||||
|
||||
return decorAvatarDecoration ? { asset: decorAvatarDecoration, skuId: SKU_ID } : null;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue