diff options
| author | Dan Engelbrecht <[email protected]> | 2022-03-15 10:49:00 +0100 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-03-31 11:28:31 +0200 |
| commit | 2c52346a73b96205252ca230798fcdf61e254dc7 (patch) | |
| tree | 763d64ca842daa188768f1def2bc3d55a6bbf1d2 /zencore/filesystem.cpp | |
| parent | clang format (diff) | |
| download | zen-2c52346a73b96205252ca230798fcdf61e254dc7.tar.xz zen-2c52346a73b96205252ca230798fcdf61e254dc7.zip | |
Handle error GetFinalPathNameByHandleW when file handle is closed
Diffstat (limited to 'zencore/filesystem.cpp')
| -rw-r--r-- | zencore/filesystem.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp index 041abaf1d..e2778089b 100644 --- a/zencore/filesystem.cpp +++ b/zencore/filesystem.cpp @@ -921,6 +921,10 @@ PathFromHandle(void* NativeHandle) } const DWORD RequiredLengthIncludingNul = GetFinalPathNameByHandleW(NativeHandle, nullptr, 0, FILE_NAME_OPENED); + if (RequiredLengthIncludingNul == 0) + { + ThrowLastError(fmt::format("failed to get path from file handle {}", NativeHandle)); + } std::wstring FullPath; FullPath.resize(RequiredLengthIncludingNul - 1); |