Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
查看发布数据报错添加账户防护
daoyian1f8483ea4c1e
diff --git a/src/components/AvatarPlat/index.tsx b/src/components/AvatarPlat/index.tsxindex 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? {