From dc5a675442974a4787e65ec698f7bd5238f9a6df Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 5 Jan 2023 19:40:21 +0100 Subject: [PATCH] fix uninitialized value in multiplication when wind_guest not given --- controls_Weather.txt | 4 ++-- lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/controls_Weather.txt b/controls_Weather.txt index 334cdca..f8b3466 100644 --- a/controls_Weather.txt +++ b/controls_Weather.txt @@ -1,4 +1,4 @@ -UPD 2023-01-05_08:20:31 55320 FHEM/59_Weather.pm +UPD 2023-01-05_18:36:31 55320 FHEM/59_Weather.pm UPD 2023-01-04_16:37:24 49883 lib/FHEM/APIs/Weather/DarkSkyAPI.pm -UPD 2023-01-05_17:01:28 33191 lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm +UPD 2023-01-05_19:39:00 33259 lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm UPD 2023-01-04_16:37:24 36090 lib/FHEM/APIs/Weather/wundergroundAPI.pm diff --git a/lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm b/lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm index 234df26..ac9070e 100644 --- a/lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm +++ b/lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm @@ -723,8 +723,10 @@ sub _FillSelfHashWithWeatherResponseForOnecallCurrent { 'wind_speed' => int( sprintf( "%.1f", ( $data->{current}->{wind_speed} * 3.6 ) ) + 0.5 ), - 'wind_gust' => int( - sprintf( "%.1f", ( $data->{current}->{wind_gust} * 3.6 ) ) + 0.5 + 'wind_gust' => ( + $data->{current}->{wind_gust} ? int( + sprintf( "%.1f", ( $data->{current}->{wind_gust} * 3.6 ) ) + 0.5 + ) : 0 ), 'wind_direction' => $data->{current}->{wind_deg}, 'rain_1h' => ( $data->{rain}->{'1h'} ? $data->{rain}->{'1h'} : 0 ),