From bee57ee37ad185475b0c3fc13f2ebf52227a219a Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 15 Apr 2024 22:54:32 +0200 Subject: [PATCH] fixed more cases of faulty empty array handling --- webclient/pages/[view]/[id].vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webclient/pages/[view]/[id].vue b/webclient/pages/[view]/[id].vue index 689d5362d..f7d3ccbd1 100644 --- a/webclient/pages/[view]/[id].vue +++ b/webclient/pages/[view]/[id].vue @@ -23,7 +23,7 @@ const runtimeConfig = useRuntimeConfig(); const url = computed(() => `${runtimeConfig.public.apiURL}/api/get/${route.params.id}?lang=${locale.value}`); const { data, error } = useFetch(url, { key: "details" }); -const shownImage = ref(data.value?.imgs ? data.value.imgs[0] : undefined); +const shownImage = ref(data.value?.imgs?.length ? data.value.imgs[0] : undefined); const slideshowOpen = ref(false); const clipboardSource = computed(() => `https://nav.tum.de${route.fullPath}`); @@ -55,7 +55,7 @@ watch([data], () => { slideshowOpen.value = false; selectedMap.value = data.value.maps.default; // --- Images --- - shownImage.value = data.value.imgs ? data.value.imgs[0] : undefined; + shownImage.value = data.value.imgs?.length ? data.value.imgs[0] : undefined; tryToLoadMap(); });