TT#50701 NGCP::Tempalte::Object: Handle empty peername for self in firstname

When the hostname is self or unknown, we do not return any peername,
so should cope with that to avoid doing comparisons that will end up
emitting warnings.

Change-Id: Ib7e70666991a76b99e1f64ca365a3018320728ec
changes/77/36077/1
Guillem Jover 6 years ago
parent d09d18d489
commit de9aacadf6

@ -107,8 +107,9 @@ sub get_firstname
if (not exists $self->{config}{hosts}{$hostname}) {
return 'self';
} else {
my @hosts = ($hostname);
my $peername = $self->get_peername($hostname);
my @hosts = ($hostname, $peername);
push @hosts, $peername if defined $peername;
return (sort @hosts)[0];
}

Loading…
Cancel
Save