Skip to content

Let's use AI to Earn!

查看发布数据报错添加账户防护

daoyian1f8483ea4c1e
diff --git a/src/components/AvatarPlat/index.tsx b/src/components/AvatarPlat/index.tsx
index 690134fc..ce271963 100644
--- a/src/components/AvatarPlat/index.tsx
+++ b/src/components/AvatarPlat/index.tsx
@@ -36,7 +36,18 @@ const AvatarPlat = memo(
}: IAvatarPlatProps,
ref: ForwardedRef<IAvatarPlatRef>,
) => {
- const plat = AccountPlatInfoMap.get(account.type)!;
+ // 添加防护检查
+ if (!account || !account.type) {
+ console.warn('AvatarPlat: account or account.type is undefined', account);
+ return null;
+ }
+
+ const plat = AccountPlatInfoMap.get(account.type);
+ if (!plat) {
+ console.warn('AvatarPlat: platform not found for type', account.type);
+ return null;
+ }
+
return (
<>
<div className={`${styles.avatarPlat} ${className}`}>
@@ -45,7 +56,7 @@ const AvatarPlat = memo(
size={avatarWidth ? avatarWidth : size}
/>
<img
- src={plat?.icon}
+ src={plat.icon}
style={
!width
? {