mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-26 11:37:12 +00:00
Close handle if valid for move assignment
This commit is contained in:
parent
8a724eb772
commit
8f7ec42c09
@ -45,6 +45,8 @@ namespace Platform::File {
|
|||||||
ScopedHandle& operator=(const ScopedHandle& other) = delete;
|
ScopedHandle& operator=(const ScopedHandle& other) = delete;
|
||||||
ScopedHandle& operator=(ScopedHandle&& other) noexcept
|
ScopedHandle& operator=(ScopedHandle&& other) noexcept
|
||||||
{
|
{
|
||||||
|
if (mHandle != Handle::Invalid)
|
||||||
|
close(mHandle);
|
||||||
mHandle = other.mHandle;
|
mHandle = other.mHandle;
|
||||||
other.mHandle = Handle::Invalid;
|
other.mHandle = Handle::Invalid;
|
||||||
return *this;
|
return *this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user