From 5a3d3a50d3470ca2844e81001b8fb78d34fd8193 Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Wed, 27 Jan 2021 18:07:25 +0100 Subject: [PATCH] Add check to prevent undefined access attempts --- 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 a42cc8dcb37f..2cd040cf370b 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({