2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 08:11:44 +00:00

70_Pushover: more robust JSON decoding (forum #76842)

git-svn-id: https://svn.fhem.de/fhem/trunk@15162 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2017-10-01 11:25:11 +00:00
parent 4178b2b380
commit 5475734ad7

View File

@ -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 "" ) {