Skip to content

Commit

Permalink
fix: do not access dominant_colors if parent object colors is und…
Browse files Browse the repository at this point in the history
…efined
  • Loading branch information
sherwinski authored and sherwinski committed Feb 3, 2022
1 parent bf278d0 commit 467f9a4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,10 @@ export default class Dialog extends Component<DialogProps, DialogState> {
stringifyJsonFields = (asset: AssetProps) => {
const replaceNullWithEmptyString = (_: any, value: any) => (value === null) ? "" : value;
asset.attributes.custom_fields = JSON.stringify(asset.attributes.custom_fields, replaceNullWithEmptyString);
asset.attributes.colors.dominant_colors = JSON.stringify(asset.attributes.colors.dominant_colors, replaceNullWithEmptyString);
asset.attributes.tags = JSON.stringify(asset.attributes.tags, replaceNullWithEmptyString);
if (asset.attributes.colors?.dominant_colors) {
asset.attributes.colors.dominant_colors = JSON.stringify(asset.attributes.colors?.dominant_colors, replaceNullWithEmptyString);
}
};

/*
Expand Down

0 comments on commit 467f9a4

Please sign in to comment.