Skip to content

Commit

Permalink
fix(core): Fix null reference error when hydrating entity
Browse files Browse the repository at this point in the history
In the case that an entity has _only_ `localeString` or `localeText` custom fields, a
`Cannot convert undefined or null to object` error could result when hydrating the custom fields
because the entity itself did not have a customFields object.

Fixes #2264
  • Loading branch information
michaelbromley committed Jul 3, 2023
1 parent 52a09a4 commit 5a2b2b7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export class LocaleStringHydrator {
}
if (localeStringProp === 'customFields') {
(entity as any)[localeStringProp] = Object.assign(
(entity as any)[localeStringProp],
(translated as any)[localeStringProp],
(entity as any)[localeStringProp] ?? {},
(translated as any)[localeStringProp] ?? {},
);
} else {
(entity as any)[localeStringProp] = (translated as any)[localeStringProp];
Expand Down

0 comments on commit 5a2b2b7

Please sign in to comment.