2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-17 05:16:02 +00:00

fhem.pl: add undef check to AttrNum (Forum #70496)

git-svn-id: https://svn.fhem.de/fhem/trunk@13989 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-04-14 15:01:35 +00:00
parent cfe8915e2b
commit e98e2c8425

View File

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