fix: handle case where images array is undefined in Gallery component

This commit is contained in:
2025-11-23 23:58:57 +08:00
parent 4b1639e789
commit 79441a7226

View File

@@ -2074,7 +2074,7 @@ function Gallery({ images, nsfw }: { images: number[], nsfw: number[] }) {
// 预加载下一张图片 // 预加载下一张图片
useEffect(() => { useEffect(() => {
if (images.length <= 1) return; if (!images || images.length <= 1) return;
const nextIndex = (currentIndex + 1) % images.length; const nextIndex = (currentIndex + 1) % images.length;
const nextImageUrl = network.getImageUrl(images[nextIndex]); const nextImageUrl = network.getImageUrl(images[nextIndex]);