From 9e1d61afe8012ce16c3a63bb5007b6d4734d7c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 27 May 2024 12:21:54 +0200 Subject: [PATCH] fix(customwmsbasemaoeditor.tsx): fix error when clearing layers in undefined wms options object When config.wms is undefined the clearing of the layers array threw an error. This is fixed by checking if the context.options.config.wms object is undefined or not. --- src/editor/CustomWMSBasemapEditor.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/editor/CustomWMSBasemapEditor.tsx b/src/editor/CustomWMSBasemapEditor.tsx index 9251ad3..e596011 100644 --- a/src/editor/CustomWMSBasemapEditor.tsx +++ b/src/editor/CustomWMSBasemapEditor.tsx @@ -77,7 +77,9 @@ export const CustomWMSBasemapEditor = ({ item, value, onChange, context }: Props { setURL(e.currentTarget.value); - (context.options.config.wms.layers as string[]).splice(-1); + if (context.options.config.wms) { + (context.options.config.wms.layers as string[]).splice(-1); + } setOptions([]); setSelection([]); }}>