From d7e62190709e527834950ae8b8a733e54ae67107 Mon Sep 17 00:00:00 2001 From: Fredrik Oseberg Date: Wed, 28 Apr 2021 18:09:37 +0200 Subject: [PATCH] fix: only get legalValues if definition exists --- .../variant/AddVariant/OverrideConfig/OverrideConfig.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/component/feature/variant/AddVariant/OverrideConfig/OverrideConfig.jsx b/frontend/src/component/feature/variant/AddVariant/OverrideConfig/OverrideConfig.jsx index ab79ae4f37..fc65f47c72 100644 --- a/frontend/src/component/feature/variant/AddVariant/OverrideConfig/OverrideConfig.jsx +++ b/frontend/src/component/feature/variant/AddVariant/OverrideConfig/OverrideConfig.jsx @@ -33,9 +33,10 @@ const OverrideConfig = ({ }; return overrides.map((o, i) => { - const legalValues = - contextDefinitions.find(c => c.name === o.contextName) - .legalValues || []; + const definition = contextDefinitions.find( + c => c.name === o.contextName + ); + const legalValues = definition ? definition.legalValues : []; return (