1
0
Fork 0
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:
ζeh Matt 2022-07-18 23:11:09 +03:00
parent 8a724eb772
commit 8f7ec42c09
No known key found for this signature in database
GPG key ID: 18CE582C71A225B0

View file

@ -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;