mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 20:06:40 +00:00
Close handle if valid for move assignment
This commit is contained in:
parent
8a724eb772
commit
8f7ec42c09
1 changed files with 2 additions and 0 deletions
|
@ -45,6 +45,8 @@ namespace Platform::File {
|
|||
ScopedHandle& operator=(const ScopedHandle& other) = delete;
|
||||
ScopedHandle& operator=(ScopedHandle&& other) noexcept
|
||||
{
|
||||
if (mHandle != Handle::Invalid)
|
||||
close(mHandle);
|
||||
mHandle = other.mHandle;
|
||||
other.mHandle = Handle::Invalid;
|
||||
return *this;
|
||||
|
|
Loading…
Reference in a new issue