diff --git a/src/lib/components/pages/album/day/DayAlbumEditPage.svelte b/src/lib/components/pages/album/day/DayAlbumEditPage.svelte index 3a0cecd..6947bd6 100644 --- a/src/lib/components/pages/album/day/DayAlbumEditPage.svelte +++ b/src/lib/components/pages/album/day/DayAlbumEditPage.svelte @@ -27,7 +27,11 @@ const imagePath = e.detail.path; console.log(`: thumbnail ${imagePath}`, e.detail); const imageLeafPath = getLeafItemOnPath(imagePath); - setAlbumThumbnail(album.path, imageLeafPath); + if (imageLeafPath) { + setAlbumThumbnail(album.path, imageLeafPath); + } else { + console.error(`: can't find leaf item on thumbnail ${imagePath}`); + } } diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index c87138c..3ebd253 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -32,7 +32,7 @@ * @param path path to album */ function getAlbum(path: string): Album | undefined { - return albumStore.getFromInMemory(path).album; + return albumStore.getFromInMemory(path)?.album ?? undefined; }