luci-mod-network: gracefully handle empty channel lists
authorJo-Philipp Wich <redacted>
Thu, 27 Oct 2022 14:08:11 +0000 (16:08 +0200)
committerJo-Philipp Wich <redacted>
Thu, 27 Oct 2022 14:10:47 +0000 (16:10 +0200)
Avoid undefined value access when the channel list is empty.

Fixes: #5937, #5951
Signed-off-by: Jo-Philipp Wich <redacted>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js

index e5e217346299cfa0bdf951b34cf423127b0522c7..dec45862688f783666e9e8bf572fdfba7fbc4fea 100644 (file)
@@ -480,7 +480,7 @@ var CBIWifiFrequencyValue = form.Value.extend({
                this.toggleWifiBand(elem);
 
                bwdt.value = htval;
-               chan.value = chval || chan.options[0].value;
+               chan.value = chval || (chan.options[0] ? chan.options[0].value : 'auto');
 
                return elem;
        },
git clone https://git.99rst.org/PROJECT