fix undefined value

Can't use an undefined value as an ARRAY reference at ./FHEM/59_Weather.pm line 589
This commit is contained in:
Marko Oldenburg 2022-12-24 12:57:41 +01:00
parent 7d0a835c71
commit 745fea37e2

View File

@ -586,7 +586,9 @@ sub Weather_WriteReadings {
else {
Weather_DeleteAlertsReadings($hash);
readingsBulkUpdate( $hash, 'warnCount',
scalar( @{ $dataRef->{alerts} } ) );
scalar( @{ $dataRef->{alerts} } ) )
if ( defined( $dataRef->{alerts} )
&& ref( $dataRef->{alerts} ) eq 'ARRAY' );
}
### state