diff --git a/pandora_server/lib/PandoraFMS/Recon/Base.pm b/pandora_server/lib/PandoraFMS/Recon/Base.pm index bbe7802097..a7cc451cc9 100644 --- a/pandora_server/lib/PandoraFMS/Recon/Base.pm +++ b/pandora_server/lib/PandoraFMS/Recon/Base.pm @@ -1358,7 +1358,7 @@ sub prepare_agent($$) { $self->{'agents_found'} = {} if ref($self->{'agents_found'}) ne 'HASH'; # Already initialized. - return if ref($self->{'agents_found'}->{$host_name}) eq 'HASH'; + return if ref($self->{'agents_found'}->{$addr}) eq 'HASH'; my @addresses = $self->get_addresses($addr); $self->{'agents_found'}->{$addr} = { diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index 4b1486f0ef..cf9f01f5e1 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -2390,18 +2390,15 @@ sub p_encode_json { ################################################################################ sub p_decode_json { my ($pa_config, $data) = @_; - - # Initialize JSON manager. - my $json = JSON->new->allow_nonref; my $decoded_data; - - if ($JSON::VERSION > 2.90) { - $decoded_data = $json->decode($data); - } else { - if (!is_empty($decoded_data)) { - $decoded_data = decode_json($data); - } - } + + if ($JSON::VERSION > 2.90) { + # Initialize JSON manager. + my $json = JSON->new->allow_nonref; + $decoded_data = $json->decode($data); + } else { + $decoded_data = decode_json($data); + } return $decoded_data; }