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:42:00 +0000 (22:42 +0100)
Signed-off-by: Paul Donald <[email protected]>
(cherry picked from commit 4207c2c5d51470fd273441f92b0a2c104441454c)

protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js

index a3ce76c96c8771958cc3fa63722e1f65eec63045..603052f6c6e7e47e66387bc24c7d328a4e2a78a4 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);
                                });