diff --git a/fhem/CHANGED b/fhem/CHANGED index 5a03f1f46..e79ca90c2 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 10_WS980: v.1.5.0 fix fhem-crash when autodiscovery fails - change: 10_WS980: allow to ignore invalid values - feature: 49_SSCam: new value 8.2.8-xxxx for attr simu_SVSversion - bugfix: 76_SMAInverter:fix ETOTAL/LOADTOTAL bug diff --git a/fhem/FHEM/10_WS980.pm b/fhem/FHEM/10_WS980.pm index 07a6b5749..16ce495d7 100644 --- a/fhem/FHEM/10_WS980.pm +++ b/fhem/FHEM/10_WS980.pm @@ -33,7 +33,7 @@ use warnings; use IO::Socket::INET; use POSIX qw(strftime); -my $version = "1.4.0"; +my $version = "1.5.0"; #------------------------------------------------------------------------------------------------------ # global constants @@ -451,10 +451,18 @@ sub WS980_autodiscoverIP($) WS980_Log($hash, 4, "received raw reply: " . WS980_hexDump($rawbuf)); my ($typeStr, $buf) = WS980_handleReply($hash, $rawbuf); - my ($ip1, $ip2, $ip3, $ip4, $port, $stationName) = unpack("x[6]CCCCnC/A", $buf); - WS980_Log($hash, 2, "reply: $ip1, $ip2, $ip3, $ip4, $port, $stationName"); - return (sprintf("%d.%d.%d.%d", $ip1, $ip2, $ip3, $ip4), $port); + if (defined($buf)) { + my ($ip1, $ip2, $ip3, $ip4, $port, $stationName) = unpack("x[6]CCCCnC/A", $buf); + WS980_Log($hash, 2, "autodiscovery-reply: $ip1, $ip2, $ip3, $ip4, $port, $stationName"); + + return (sprintf("%d.%d.%d.%d", $ip1, $ip2, $ip3, $ip4), $port); + } + else + { + WS980_Log($hash, 1, "autodiscovery failed: looks like the reply could not be decoded"); + return (undef,undef); + } }