dns/ddclient - validate statistics before usage to prevent missing fields, for now let's assume mtime is always filled, ip apparantly isn't. ref https://forum.opnsense.org/index.php?topic=28835.msg140355

This commit is contained in:
Ad Schellevis
2022-06-24 20:11:31 +02:00
parent 285dcd88c3
commit 339993680d
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -1,5 +1,6 @@
PLUGIN_NAME= ddclient
PLUGIN_VERSION= 1.7
PLUGIN_REVISION= 1
PLUGIN_DEPENDS= ddclient
PLUGIN_COMMENT= Dynamic DNS client
PLUGIN_MAINTAINER= ad@opnsense.org
@@ -50,7 +50,7 @@ class AccountField extends ArrayField
if (!empty((string)$node->hostnames)) {
foreach (explode(",", (string)$node->hostnames) as $hostname) {
if (!empty((self::$current_stats[$hostname]))) {
if (!empty((self::$current_stats[$hostname]) && !empty(self::$current_stats[$hostname]['ip']))) {
$stats = self::$current_stats[$hostname];
$current_ip->setValue($stats['ip']);
$current_mtime->setValue(date('c', $stats['mtime']));