diff --git a/lib/Generic_Item.pm b/lib/Generic_Item.pm index 4896a6966..acf58f291 100644 --- a/lib/Generic_Item.pm +++ b/lib/Generic_Item.pm @@ -1059,7 +1059,7 @@ sub set_state_log { $target = '' unless defined $target; unshift(@{$$self{state_log}}, "$main::Time_Date $state set_by=$set_by_name" . (($target)?"target=$target":'')) - if $state or (ref $self) eq 'Voice_Cmd'; + if defined($state) or (ref $self) eq 'Voice_Cmd'; pop @{$$self{state_log}} if $$self{state_log} and @{$$self{state_log}} > $main::config_parms{max_state_log_entries}; diff --git a/lib/http_server.pl b/lib/http_server.pl index ace04ad86..a81e5cd63 100644 --- a/lib/http_server.pl +++ b/lib/http_server.pl @@ -2381,7 +2381,7 @@ sub html_item_state { my $filename = $object->{filename}; my $state_now = $object->{state}; my $html; - $state_now = '' unless $state_now; # Avoid -w uninitialized value msg + $state_now = '' unless defined($state_now); # Avoid -w uninitialized value msg # If >2 possible states, add a Select pull down form my @states; @@ -2407,7 +2407,7 @@ sub html_item_state { if (my $h_icon = &html_find_icon_image($object, $object_type)) { $html .= qq[$object_name]; } - elsif ($state_now) { + elsif ($state_now ne '') { my $temp = $state_now; $temp = substr($temp, 0, 8) . '..' if length $temp > 8; $html .= $temp . ' ';