luci-proto-wireguard: gracefully deal with missing uci configs
authorJo-Philipp Wich <jo@mein.io>
Mon, 20 Jun 2022 22:07:04 +0000 (00:07 +0200)
committerJo-Philipp Wich <jo@mein.io>
Mon, 20 Jun 2022 22:07:48 +0000 (00:07 +0200)
The /etc/config/ddns in particular might not be present on the system,
don't fail if it is absent.

Fixes: #5838
Fixes: 9ba20645b0 ("luci-proto-wireguard: rewrite protocol handler")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js

index 6fb8b9a398269494caa02501216ee886e2cd4643..e2abd3b71d0ac111fd53c553148fe84fe9c7d3b4 100644 (file)
@@ -686,8 +686,8 @@ return network.registerProtocol('wireguard', {
                        return Promise.all([
                                network.getWANNetworks(),
                                network.getWAN6Networks(),
-                               uci.load('ddns'),
-                               uci.load('system'),
+                               L.resolveDefault(uci.load('ddns')),
+                               L.resolveDefault(uci.load('system')),
                                parent.save(null, true)
                        ]).then(function(data) {
                                var hostnames = [];