From 3eceb38a8e59034a74234d2101bc7651f0d555b9 Mon Sep 17 00:00:00 2001 From: rudolfkoenig Date: Wed, 17 Sep 2025 13:19:49 +0000 Subject: [PATCH] 01_FHEMWEB.pm: Fix "style edit" when called before "style list" (Forum #142498) git-svn-id: https://svn.fhem.de/fhem/trunk@30304 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/01_FHEMWEB.pm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index f195a6b04..6f91b155f 100644 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -2572,14 +2572,27 @@ FW_style($$) my $data = ""; my $cfgDB = defined($a[3]) ? $a[3] : ""; $fileName =~ s,.*/,,g; # Little bit of security - $fileName .= ".configDB" if ($cfgDB eq 'configDB'); # add identifier if file has to be read from database + # add identifier if file has to be read from database + $fileName .= ".configDB" if ($cfgDB eq 'configDB'); + + if(!%FW_editFileToPath) { # no edit was called yet + my $old=$FW_RET; + FW_style("style list",undef); + $FW_RET=$old + } + my $filePath = $FW_editFileToPath{$fileName}{path}; - my($err, @content) = FileRead({FileName=>$filePath, ForceType=>$FW_editFileToPath{$fileName}{forceType}}); + if(!$filePath) { + FW_addContent(">$fileName is not in the editFileList$filePath, + ForceType=>$FW_editFileToPath{$fileName}{forceType}}); if($err) { FW_addContent(">$err