Skip to content

Commit

Permalink
fix(customwmsbasemaoeditor.tsx): fix error when clearing layers in un…
Browse files Browse the repository at this point in the history
…defined 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.
  • Loading branch information
felix-mu committed May 27, 2024
1 parent 39acc07 commit 9e1d61a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/editor/CustomWMSBasemapEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ export const CustomWMSBasemapEditor = ({ item, value, onChange, context }: Props
<Input value={url} aria-label="URL input"
onChange={e => {
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([]);
}}></Input>
Expand Down

0 comments on commit 9e1d61a

Please sign in to comment.