From bc2e5950ff25ea0d3666bd1f21f53d74bb537b0a Mon Sep 17 00:00:00 2001 From: loredo Date: Sun, 1 Oct 2017 11:25:11 +0000 Subject: [PATCH] 70_Pushover: more robust JSON decoding (forum #76842) git-svn-id: https://svn.fhem.de/fhem/trunk@15162 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/70_Pushover.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/70_Pushover.pm b/fhem/FHEM/70_Pushover.pm index c96e9b857..9a0760f1e 100644 --- a/fhem/FHEM/70_Pushover.pm +++ b/fhem/FHEM/70_Pushover.pm @@ -537,8 +537,12 @@ sub Pushover_ReceiveCommand($$$) { require JSON; import JSON qw( decode_json ); }; - $return = decode_json( Encode::encode_utf8($data) ) - if ( !$@ ); + unless ($@) { + my $json = JSON->new->allow_nonref; + my $obj = + eval { $json->decode( Encode::encode_utf8($data) ) }; + $return = $obj unless ($@); + } } else { if ( !defined($cmd) || ref($cmd) eq "HASH" || $cmd eq "" ) {