porkbun: Invert condition to improve readability

This commit is contained in:
Richard Hansen 2024-07-23 01:56:19 -04:00
parent d8a23ff9a4
commit 536c7c87a2

View file

@ -6819,7 +6819,10 @@ sub nic_porkbun_update {
next;
}
my $records = $response->{records};
if (ref($records) eq 'ARRAY' && defined $records->[0]->{'id'}) {
if (ref($records) ne 'ARRAY' || !defined($records->[0]{'id'})) {
failed("$h: no applicable existing records");
next;
}
warning("$h: There are multiple applicable records. Only first record is used. Overwrite all with the same content.")
if @$records > 1;
if ($records->[0]{'content'} eq $ip) {
@ -6854,11 +6857,6 @@ sub nic_porkbun_update {
}
$config{$h}{"status-ipv$ipv"} = "good";
success("$h: IPv%s address set to $ip");
next;
} else {
failed("$h: no applicable existing records");
next;
}
}
}
}