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