From c1ec47401219d9db89745a6a7bf7695094c540d8 Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Sat, 10 Jun 2023 11:17:11 +0200 Subject: [PATCH] Handle undefined object --- apps/api/src/helper/object.helper.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/api/src/helper/object.helper.ts b/apps/api/src/helper/object.helper.ts index 6db53b0a1..50a4f2b12 100644 --- a/apps/api/src/helper/object.helper.ts +++ b/apps/api/src/helper/object.helper.ts @@ -16,9 +16,11 @@ export function hasNotDefinedValuesInObject(aObject: Object): boolean { export function nullifyValuesInObject(aObject: T, keys: string[]): T { const object = cloneDeep(aObject); - keys.forEach((key) => { - object[key] = null; - }); + if (object) { + keys.forEach((key) => { + object[key] = null; + }); + } return object; }