From fdad22a58f4b86767351b6b1d3c2c409c872a3ed Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Thu, 10 May 2018 14:06:03 +0000 Subject: [PATCH] 98_SVG.pm: fix error message if SVG_showLog is called with junk (Forum #87561) git-svn-id: https://svn.fhem.de/fhem/trunk@16719 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_SVG.pm | 14 ++++++++------ fhem/www/gplot/template.gplot | 4 +--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fhem/FHEM/98_SVG.pm b/fhem/FHEM/98_SVG.pm index 74e909ac9..165e99e7b 100644 --- a/fhem/FHEM/98_SVG.pm +++ b/fhem/FHEM/98_SVG.pm @@ -764,17 +764,19 @@ SVG_readgplotfile($$$) # Read in the template gnuplot file. Digest the #FileLog lines. Replace # the plot directive with our own, as we offer a file for each line my (%srcDesc, @data, $plot); + my ($err1, $err2, @svgplotfile); + return ("Nonexisting device $wl specified", @svgplotfile) + if(!$defs{$wl}); my $ld = $defs{$wl}{LOGDEVICE} - if($defs{$wl} && $defs{$wl}{LOGDEVICE}); + if($defs{$wl}{LOGDEVICE}); my $ldType = $defs{$defs{$wl}{LOGDEVICE}}{TYPE} if($ld && $defs{$ld}); - if(!$ldType && $defs{$wl}) { + if(!$ldType) { $ldType = $defs{$wl}{TYPE}; $ld = $wl; } - my ($err1, $err2, @svgplotfile); ($err1, @svgplotfile) = FileRead($gplot_pgm); ($err2, @svgplotfile) = FileRead("$FW_gplotdir/template.gplot") if($err1); return ($err1, undef) if($err2); @@ -819,7 +821,7 @@ SVG_readgplotfile($$$) } if($plotfn) { - Log 3, "$wl: space is not allowed in $ldType definition: $plotfn" + Log 3, "$wl: space is not allowed in >$ldType< definition: $plotfn" if($plotfn =~ m/\s/); if ($specval) { my @spec = split(" ",$specval); @@ -1113,10 +1115,10 @@ SVG_doShowLog($$$$;$) my ($err, $cfg, $plot, $srcDesc) = SVG_readgplotfile($wl, $gplot_pgm, $pm); if($err || !$defs{$d}) { - my $msg = ($defs{$d} ? "Cannot read $gplot_pgm" : "No Logdevice $d"); + my $msg = ($err ? $err : "No Logdevice >$d<"); Log3 $FW_wname, 1, $msg; - if($pm =~ m/SVG/) { # FW_fatal for SVG: + if($pm && $pm =~ m/SVG/) { # FW_fatal for SVG: $FW_RETTYPE = "image/svg+xml"; FW_pO ''; FW_pO ''.$msg.''; diff --git a/fhem/www/gplot/template.gplot b/fhem/www/gplot/template.gplot index c03fbe4f7..5fab8102e 100644 --- a/fhem/www/gplot/template.gplot +++ b/fhem/www/gplot/template.gplot @@ -1,7 +1,5 @@ ############################ -# Display the power reported by the EM1010 -# Corresponding FileLog definition: -# define ememlog FileLog /var/log/fhem/emem-%Y.log emem:power.* +# Template .gplot file for creating a new SVG instance set terminal png transparent size crop set output '.png'