2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

fhem.pl: Do not regexp-check undef in ReadingsNum (Forum #70496)

git-svn-id: https://svn.fhem.de/fhem/trunk@13983 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-04-13 19:04:11 +00:00
parent f58034675b
commit 4e6880616f

View File

@ -3974,6 +3974,7 @@ ReadingsNum($$$;$)
{ {
my ($d,$n,$default,$round) = @_; my ($d,$n,$default,$round) = @_;
my $val = ReadingsVal($d,$n,$default); my $val = ReadingsVal($d,$n,$default);
return undef if(!defined($val));
$val = ($val =~ /(-?\d+(\.\d+)?)/ ? $1 : ""); $val = ($val =~ /(-?\d+(\.\d+)?)/ ? $1 : "");
$val = round($val,$round) if($round); $val = round($val,$round) if($round);
return $val; return $val;