From c1bb34ab112d960bb5b9cc358cb9ac717af2a469 Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Fri, 7 Apr 2017 10:28:55 +0000 Subject: [PATCH] Fix #1207 --- .../lib/Lemonldap/NG/Common/Conf/RESTServer.pm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/RESTServer.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/RESTServer.pm index 9ed252c65..8533f199f 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/RESTServer.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/RESTServer.pm @@ -716,14 +716,13 @@ sub getKey { } elsif ( $key =~ qr/^$doubleHashKeys$/o ) { my @res; - if ( defined $value ) { - foreach my $host ( sort keys %$value ) { - my @tmp; - foreach my $k ( sort keys %{ $value->{$host} } ) { - push @tmp, { k => $k, v => $value->{$host}->{$k} }; - } - push @res, { k => $host, h => \@tmp }; + $value ||= {}; + foreach my $host ( sort keys %$value ) { + my @tmp; + foreach my $k ( sort keys %{ $value->{$host} } ) { + push @tmp, { k => $k, v => $value->{$host}->{$k} }; } + push @res, { k => $host, h => \@tmp }; } return $self->sendJSONresponse( $req, { value => \@res } ); }