From 58e2f557da49e5acb1d4395a9698b1953f1586c3 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 10 Feb 2016 18:23:39 +0100 Subject: luci-base: cbi: only spawn dynlist sub-comboboxes if choices are available Signed-off-by: Jo-Philipp Wich --- modules/luci-base/htdocs/luci-static/resources/cbi.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index b27c56492..a1491cc66 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -550,10 +550,14 @@ function cbi_init() { for (var i = 0, node; (node = nodes[i]) !== undefined; i++) { var choices = JSON.parse(node.getAttribute('data-dynlist')); - var options = {}; + var options = null; - for (var j = 0; j < choices[0].length; j++) - options[choices[0][j]] = choices[1][j]; + if (choices[0] && choices[0].length) { + options = {}; + + for (var j = 0; j < choices[0].length; j++) + options[choices[0][j]] = choices[1][j]; + } cbi_dynlist_init(node, choices[2], choices[3], options); } -- cgit v1.2.3