luci-mod-network: gracefully handle empty channel lists

Avoid undefined value access when the channel list is empty.

Fixes: #5937, #5951
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2022-10-27 16:08:11 +02:00
parent 4d6a238098
commit 9af8486517

View file

@ -480,7 +480,7 @@ var CBIWifiFrequencyValue = form.Value.extend({
this.toggleWifiBand(elem); this.toggleWifiBand(elem);
bwdt.value = htval; bwdt.value = htval;
chan.value = chval || chan.options[0].value; chan.value = chval || (chan.options[0] ? chan.options[0].value : 'auto');
return elem; return elem;
}, },