Skip to content

Commit

Permalink
fix(npm): handle nil arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
bounoable committed Sep 24, 2022
1 parent 4ef6cce commit 389c2b2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/media-entity/src/entities/gallery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function hydrateGallery<Languages extends string = string>(
): Gallery<Languages> {
return {
...data,
stacks: data.stacks.map((data) => hydrateStack(data)),
stacks: (data.stacks || []).map((data) => hydrateStack(data)),
}
}

Expand All @@ -53,7 +53,8 @@ export function hydrateStack<Languages extends string = string>(
): Stack<Languages> {
return {
...data,
variants: data.variants.map(hydrateStackImage),
variants: (data.variants || []).map(hydrateStackImage),
tags: data.tags || [],
}
}

Expand Down

0 comments on commit 389c2b2

Please sign in to comment.