From 1599f31b29b02ea18491a0c8691fdfcd46e5df0a Mon Sep 17 00:00:00 2001 From: damian-s Date: Sat, 10 May 2014 18:03:59 +0000 Subject: [PATCH] fixed: skip blanks at the end of a block git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@5813 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_IF.pm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fhem/FHEM/98_IF.pm b/fhem/FHEM/98_IF.pm index 47e5cfbd3..cf09311bc 100644 --- a/fhem/FHEM/98_IF.pm +++ b/fhem/FHEM/98_IF.pm @@ -240,18 +240,18 @@ ParseCommandsIf($) $currentBlock=$tailBlock; $tailBlock=""; } - if ($currentBlock ne "") { - $currentBlock =~ s/'/\\'/g; - ($currentBlock,$err)=ReplaceAllReadingsIf($currentBlock,1); - return ($currentBlock,$err) if ($err); - ($currentBlock,$err)=EvalAllIf($currentBlock); - $currentBlock =~ s/;/;;/g; - return ($currentBlock,$err) if ($err); - $parsedCmd.="fhem('".$currentBlock."')"; + if ($currentBlock =~ /[^\s]/g) { + $currentBlock =~ s/'/\\'/g; + ($currentBlock,$err)=ReplaceAllReadingsIf($currentBlock,1); + return ($currentBlock,$err) if ($err); + ($currentBlock,$err)=EvalAllIf($currentBlock); + $currentBlock =~ s/;/;;/g; + return ($currentBlock,$err) if ($err); + $parsedCmd.="fhem('".$currentBlock."')"; + $parsedCmd.=";;" if ($tailBlock); + } else { $parsedCmd.=";;" if ($tailBlock); - } else { - $parsedCmd.=";;" if ($tailBlock); - } + } } } return($parsedCmd,"");