Skip to content

Commit 2194a3d

Browse files
committed
fixed:TypeError: Cannot read properties of null (reading 'large')
1 parent 3fd6211 commit 2194a3d

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/app/page.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -372,20 +372,21 @@ function HomeClient() {
372372

373373
return todayAnimes.map((anime, index) => (
374374
<div
375-
key={`${anime.id}-${index}`}
375+
key={`${anime.id || 0}-${index}`}
376376
className='min-w-[96px] w-24 sm:min-w-[180px] sm:w-44'
377377
>
378378
<VideoCard
379379
from='douban'
380-
title={anime.name_cn || anime.name}
380+
title={anime.name_cn || anime.name || '未知标题'}
381381
poster={
382-
anime.images.large ||
383-
anime.images.common ||
384-
anime.images.medium ||
385-
anime.images.small ||
386-
anime.images.grid
382+
anime.images?.large ||
383+
anime.images?.common ||
384+
anime.images?.medium ||
385+
anime.images?.small ||
386+
anime.images?.grid ||
387+
'' // 空字符串,让 VideoCard 组件处理图片加载失败
387388
}
388-
douban_id={anime.id}
389+
douban_id={anime.id || 0}
389390
rate={anime.rating?.score?.toFixed(1) || ''}
390391
year={anime.air_date?.split('-')?.[0] || ''}
391392
isBangumi={true}

0 commit comments

Comments
 (0)