From 69d0a22091284b81af334082a3736d22f9a5f520 Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Wed, 27 Jan 2021 18:39:03 +0100 Subject: [PATCH] Add check to prevent undefined access during action validation (#8257) --- src/panels/lovelace/editor/types.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/panels/lovelace/editor/types.ts b/src/panels/lovelace/editor/types.ts index a42cc8dcb3..2cd040cf37 100644 --- a/src/panels/lovelace/editor/types.ts +++ b/src/panels/lovelace/editor/types.ts @@ -96,8 +96,14 @@ export interface EditSubElementEvent { } export const actionConfigStruct = dynamic((_value, ctx) => { - const test = actionConfigMap[ctx.branch[0][ctx.path[0]].action]; - return test || actionConfigStructType; + if (ctx.branch[0][ctx.path[0]]) { + return ( + actionConfigMap[ctx.branch[0][ctx.path[0]].action] || + actionConfigStructType + ); + } + + return actionConfigStructType; }); const actionConfigStructUser = object({