Skip to content

Commit 5568738

Browse files
author
Phil Varner
authored
Merge pull request #343 from stac-utils/pv/guard-for-thumbnail
add guard around item roles not existing in thumbnail check
2 parents b515a9e + 488b4b8 commit 5568738

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib/api.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,10 @@ const getItemThumbnail = async function (collectionId, itemId, backend) {
875875
return new Error('Item not found')
876876
}
877877

878-
const thumbnailAsset = Object.values(item.assets || []).find((x) => x.roles.includes('thumbnail'))
878+
const thumbnailAsset = Object.values(item.assets || []).find(
879+
(x) => x.roles && x.roles.includes('thumbnail')
880+
)
881+
879882
if (!thumbnailAsset) {
880883
return new Error('Thumbnail not found')
881884
}

0 commit comments

Comments
 (0)