wifi-scripts: create the wlan object in board_data if not present
authorFelix Fietkau <nbd@nbd.name>
Tue, 13 Feb 2024 18:24:53 +0000 (19:24 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 13 Feb 2024 18:26:58 +0000 (19:26 +0100)
Fixes an error in wifi detection

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc

index 86ec3431ea7d27a45f6a50cbae266bdf3f1e2023..5f375880d2ba20c4ac2b24a8458185f41d006636 100644 (file)
@@ -39,8 +39,9 @@ function cleanup() {
 }
 
 function wiphy_get_entry(phy, path) {
-       let wlan = board_data.wlan;
+       board_data.wlan ??= {};
 
+       let wlan = board_data.wlan;
        for (let name in wlan)
                if (wlan[name].path == path)
                        return wlan[name];