diff --git a/src/composables/useCurrentImage.ts b/src/composables/useCurrentImage.ts index 71a82d3c..804b2745 100644 --- a/src/composables/useCurrentImage.ts +++ b/src/composables/useCurrentImage.ts @@ -46,12 +46,13 @@ export function getImageSpatialExtent(imageID: Maybe) { export function getImageMetadata(imageID: Maybe) { const { metadata } = useImageStore(); - return imageID ? metadata[imageID] : defaultImageMetadata(); + if (!imageID) return defaultImageMetadata(); + return metadata[imageID] ?? defaultImageMetadata(); } export function getImageData(imageID: Maybe) { const { dataIndex } = useImageStore(); - return imageID ? dataIndex[imageID] : null; + return imageID ? dataIndex[imageID] ?? null : null; } export function getIsImageLoading(imageID: Maybe) {