2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-04 05:16:45 +00:00

37_harmony.pm: fix for acces to uninitialized device data

git-svn-id: https://svn.fhem.de/fhem/trunk@8751 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2015-06-15 17:03:04 +00:00
parent 9f7f26bd62
commit de0ed6de6c

View File

@ -533,10 +533,12 @@ harmony_Set($$@)
return undef if( !defined($hash->{config}) );
my $activities;
foreach my $activity (sort { ($a->{activityOrder}||0) <=> ($b->{activityOrder}||0) } @{$hash->{config}->{activity}}) {
next if( $activity->{id} == -1 );
$activities .= "," if( $activities );
$activities .= $activity->{label};
if( $hash->{config}->{activity} ) {
foreach my $activity (sort { ($a->{activityOrder}||0) <=> ($b->{activityOrder}||0) } @{$hash->{config}->{activity}}) {
next if( $activity->{id} == -1 );
$activities .= "," if( $activities );
$activities .= $activity->{label};
}
}
if( my $activity = harmony_activityOfId($hash, -1) ) {
@ -552,15 +554,17 @@ harmony_Set($$@)
my $hidDevices;
my $autocreateDevices;
foreach my $device (sort { $a->{id} <=> $b->{id} } @{$hash->{config}->{device}}) {
if( $device->{IsKeyboardAssociated} ) {
$hidDevices .= "," if( $hidDevices );
$hidDevices .= harmony_labelOfDevice($hash, $device->{id} );
}
if( $hash->{config}->{device} ) {
foreach my $device (sort { $a->{id} <=> $b->{id} } @{$hash->{config}->{device}}) {
if( $device->{IsKeyboardAssociated} ) {
$hidDevices .= "," if( $hidDevices );
$hidDevices .= harmony_labelOfDevice($hash, $device->{id} );
}
if( !defined($modules{$hash->{TYPE}}{defptr}{$device->{id}}) ) {
$autocreateDevices .= "," if( $autocreateDevices );
$autocreateDevices .= harmony_labelOfDevice($hash, $device->{id} );
if( !defined($modules{$hash->{TYPE}}{defptr}{$device->{id}}) ) {
$autocreateDevices .= "," if( $autocreateDevices );
$autocreateDevices .= harmony_labelOfDevice($hash, $device->{id} );
}
}
}