Fix: PHP error when changing container network if wireguard isn't enabled

This commit is contained in:
Squidly271
2025-09-16 21:34:37 -04:00
parent eb43127f53
commit 12ab3df1a8

View File

@@ -1094,8 +1094,8 @@ _(Network Type)_:
$n = $x ? 1 : 0; while (isset($$eth["VLANID:$n"]) && $$eth["VLANID:$n"] != $x) $n++;
if (!empty($$eth["DESCRIPTION:$n"])) $name .= ' -- '.compress(trim($$eth["DESCRIPTION:$n"]));
} elseif (preg_match('/^wg[0-9]+$/',$network)) {
$conf = file("/etc/wireguard/$network.conf");
if ($conf[1][0]=='#') $name .= ' -- '.compress(trim(substr($conf[1],1)));
$conf = is_file("/etc/wireguard/$network.conf") ? file("/etc/wireguard/$network.conf") : [];
if ( ($conf[1][0]??'')=='#') $name .= ' -- '.compress(trim(substr($conf[1],1)));
} elseif (substr($network,0,4)=='wlan') {
$name .= ' -- '._('Wireless interface');
}