diff --git a/components/ui/character-tab-content.tsx b/components/ui/character-tab-content.tsx index 44bcd92..dd11a36 100644 --- a/components/ui/character-tab-content.tsx +++ b/components/ui/character-tab-content.tsx @@ -96,7 +96,7 @@ CharacterTabContentProps useEffect(() => { console.log('-==========roleData===========-', roleData); // 只在初始化且有角色数据时执行 - if (!isInitialized && roleData.length > 0) { + if (!isInitialized && (roleData?.length || 0) > 0) { selectRole(roleData[0]); setIsInitialized(true); } @@ -391,7 +391,7 @@ CharacterTabContentProps )} - +