diff options
| author | Dan Engelbrecht <[email protected]> | 2023-09-12 08:03:46 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-12 14:03:46 +0200 |
| commit | f463686b9621b8c744e2dcb0d018ad507716d499 (patch) | |
| tree | 7cf50625dbfe3b731131b779c6286ae9ca6423d7 /src/zenutil/basicfile.cpp | |
| parent | gracefully handle errors when writing cache log (#391) (diff) | |
| download | zen-f463686b9621b8c744e2dcb0d018ad507716d499.tar.xz zen-f463686b9621b8c744e2dcb0d018ad507716d499.zip | |
Make sure error logging or destructors don't throw exception when trying to get file name from handle (#393)
- Bugfix: Make sure error logging or destructors don't throw exception when trying to get file name from handle
Diffstat (limited to 'src/zenutil/basicfile.cpp')
| -rw-r--r-- | src/zenutil/basicfile.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/zenutil/basicfile.cpp b/src/zenutil/basicfile.cpp index 84e8bed85..99aa6bf39 100644 --- a/src/zenutil/basicfile.cpp +++ b/src/zenutil/basicfile.cpp @@ -452,8 +452,12 @@ TemporaryFile::Close() SetFileInformationByHandle(m_FileHandle, FileDispositionInfo, &Fdi, sizeof Fdi); #else - std::filesystem::path FilePath = zen::PathFromHandle(m_FileHandle); - unlink(FilePath.c_str()); + std::error_code Ec; + std::filesystem::path FilePath = zen::PathFromHandle(m_FileHandle, Ec); + if (!Ec) + { + unlink(FilePath.c_str()); + } #endif BasicFile::Close(); |