Null check image visual_files (#6136)

This commit is contained in:
WithoutPants
2025-10-15 16:29:51 +11:00
committed by GitHub
parent 6d76fe690b
commit 2e8bc3536f
2 changed files with 4 additions and 4 deletions

View File

@@ -67,8 +67,8 @@ export const GalleryViewer: React.FC<IProps> = ({ galleryId }) => {
images.forEach((image, index) => { images.forEach((image, index) => {
let imageData = { let imageData = {
src: image.paths.thumbnail!, src: image.paths.thumbnail!,
width: image.visual_files[0].width, width: image.visual_files[0]?.width ?? 0,
height: image.visual_files[0].height, height: image.visual_files[0]?.height ?? 0,
tabIndex: index, tabIndex: index,
key: image.id ?? index, key: image.id ?? index,
loading: "lazy", loading: "lazy",

View File

@@ -72,8 +72,8 @@ const ImageWall: React.FC<IImageWallProps> = ({
image.paths.preview != "" image.paths.preview != ""
? image.paths.preview! ? image.paths.preview!
: image.paths.thumbnail!, : image.paths.thumbnail!,
width: image.visual_files[0].width, width: image.visual_files?.[0]?.width ?? 0,
height: image.visual_files[0].height, height: image.visual_files?.[0]?.height ?? 0,
tabIndex: index, tabIndex: index,
key: image.id, key: image.id,
loading: "lazy", loading: "lazy",