Skip to content

Commit

Permalink
More fixing up of TypeScript complaints about undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
deanmoses committed Jan 3, 2023
1 parent 7f18c72 commit 66c8033
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/lib/components/pages/album/day/DayAlbumEditPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
const imagePath = e.detail.path;
console.log(`<DayAlbumEditPage>: thumbnail ${imagePath}`, e.detail);
const imageLeafPath = getLeafItemOnPath(imagePath);
setAlbumThumbnail(album.path, imageLeafPath);
if (imageLeafPath) {
setAlbumThumbnail(album.path, imageLeafPath);
} else {
console.error(`<DayAlbumEditPage>: can't find leaf item on thumbnail ${imagePath}`);
}
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
</script>

Expand Down

0 comments on commit 66c8033

Please sign in to comment.