mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
98_WeekdayTimer: harden decode_json
git-svn-id: https://svn.fhem.de/fhem/trunk@25632 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9c4e4f5b0f
commit
852507e0ed
@ -638,7 +638,11 @@ E: while ( @{ $arr } > 0 ) {
|
|||||||
Log3( $hash, 3, "[$name] weekprofile $wp_name: no profile named \"$wp_profile\" available" );
|
Log3( $hash, 3, "[$name] weekprofile $wp_name: no profile named \"$wp_profile\" available" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my $wp_profile_unpacked = decode_json($wp_profile_data);
|
my $wp_profile_unpacked;
|
||||||
|
if ( !eval { $wp_profile_unpacked = decode_json($wp_profile_data) ; 1 } ) {
|
||||||
|
Log3($hash, 1, "$name:JSON decoding error in weekprofile: $@");
|
||||||
|
return;
|
||||||
|
}
|
||||||
$hash->{weekprofiles}{$wp_name} = {'PROFILE'=>$wp_profile,'PROFILE_JSON'=>$wp_profile_data,'SunAsWE'=>$wp_sunaswe,'PROFILE_DATA'=>$wp_profile_unpacked };
|
$hash->{weekprofiles}{$wp_name} = {'PROFILE'=>$wp_profile,'PROFILE_JSON'=>$wp_profile_data,'SunAsWE'=>$wp_sunaswe,'PROFILE_DATA'=>$wp_profile_unpacked };
|
||||||
my %wp_shortDays = ("Mon"=>1,"Tue"=>2,"Wed"=>3,"Thu"=>4,"Fri"=>5,"Sat"=>6,"Sun"=>0);
|
my %wp_shortDays = ("Mon"=>1,"Tue"=>2,"Wed"=>3,"Thu"=>4,"Fri"=>5,"Sat"=>6,"Sun"=>0);
|
||||||
for my $wp_days (sort keys %{$hash->{weekprofiles}{$wp_name}{PROFILE_DATA}}) {
|
for my $wp_days (sort keys %{$hash->{weekprofiles}{$wp_name}{PROFILE_DATA}}) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user