luci-proto-wireguard: add extra checks for hostname when building qr
authorPaul Donald <[email protected]>
Wed, 26 Mar 2025 21:40:01 +0000 (22:40 +0100)
committerPaul Donald <[email protected]>
Wed, 26 Mar 2025 21:41:23 +0000 (22:41 +0100)
Signed-off-by: Paul Donald <[email protected]>
protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js

index 0b38e9ddc13b280a5d73871fa3c82e1f9be3438f..d0751bc9fbd22e00310356f60ac57b8c43e7bf11 100644 (file)
@@ -724,12 +724,12 @@ return network.registerProtocol('wireguard', {
                                var hostnames = [];
 
                                uci.sections('ddns', 'service', function(s) {
-                                       if (typeof(s.lookup_host) == 'string' && s.enabled == '1')
+                                       if (typeof(s?.lookup_host) == 'string' && s?.enabled == '1')
                                                hostnames.push(s.lookup_host);
                                });
 
                                uci.sections('system', 'system', function(s) {
-                                       if (typeof(s.hostname) == 'string' && s.hostname.indexOf('.') > 0)
+                                       if (typeof(s?.hostname) == 'string' && s?.hostname?.indexOf('.') > 0)
                                                hostnames.push(s.hostname);
                                });