From 5f40d609d983bb4cbaf2c4c3544176e9fdd681b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 24 Jan 2023 16:47:49 +0100 Subject: [PATCH] make sure to only deepFreeze actual objects --- src/Umbraco.Web.UI.Client/libs/observable-api/deep-state.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/libs/observable-api/deep-state.ts b/src/Umbraco.Web.UI.Client/libs/observable-api/deep-state.ts index fbf5dbea81..e3235b221c 100644 --- a/src/Umbraco.Web.UI.Client/libs/observable-api/deep-state.ts +++ b/src/Umbraco.Web.UI.Client/libs/observable-api/deep-state.ts @@ -3,7 +3,7 @@ import { BehaviorSubject } from "rxjs"; // TODO: Should this handle array as well? function deepFreeze(inObj: T): T { - if(typeof inObj === 'object') { + if(inObj && typeof inObj === 'object') { Object.freeze(inObj); Object.getOwnPropertyNames(inObj)?.forEach(function (prop) {