From 926c3ba605aafaa7c2806884f504fa82a1c66508 Mon Sep 17 00:00:00 2001 From: Sergey Ponomarev Date: Tue, 25 Feb 2025 23:31:15 +0200 Subject: [PATCH] luci-base: forms.js safe call on this.map.data.remove() Signed-off-by: Sergey Ponomarev --- modules/luci-base/htdocs/luci-static/resources/form.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 2d0304003c..c9af17f1b3 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -2219,7 +2219,7 @@ const CBITypedSection = CBIAbstractSection.extend(/** @lends LuCI.form.TypedSect handleRemove(section_id, ev) { const config_name = this.uciconfig ?? this.map.config; - this.map.data.remove(config_name, section_id); + this.map.data?.remove(config_name, section_id); return this.map.save(null, true); }, @@ -3391,7 +3391,7 @@ const CBIGridSection = CBITableSection.extend(/** @lends LuCI.form.GridSection.p const prevMap = mapNode ? dom.findClassInstance(mapNode) : this.map; if (prevMap.addedSection != null && !isSaving) - this.map.data.remove(config_name, prevMap.addedSection); + this.map.data?.remove(config_name, prevMap.addedSection); delete prevMap.addedSection; @@ -3550,7 +3550,7 @@ const CBINamedSection = CBIAbstractSection.extend(/** @lends LuCI.form.NamedSect const section_id = this.section; const config_name = this.uciconfig ?? this.map.config; - this.map.data.remove(config_name, section_id); + this.map.data?.remove(config_name, section_id); return this.map.save(null, true); }, -- 2.30.2