2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

92_FileLog.pm: avoid FHEM crash if the file cannot be opened

git-svn-id: https://svn.fhem.de/fhem/trunk@23138 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2020-11-11 20:43:14 +00:00
parent c106fbc339
commit e822f7464e

View File

@ -436,7 +436,7 @@ FileLog_Set($@)
if(!FileLog_Switch($hash)) { # No rename, reopen anyway
my $fh = $hash->{FH};
my $cn = $hash->{currentlogfile};
$fh->close();
$fh->close() if($fh);
if($cmd eq "clear") {
$fh = new IO::File(">$cn");
setReadingsVal($hash, "linesInTheFile", 0, TimeNow());