mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-11 05:20:14 -04:00
Close only valid handles
This commit is contained in:
parent
2014ea40b9
commit
3c8ef8463c
@ -36,7 +36,11 @@ namespace Platform::File {
|
|||||||
public:
|
public:
|
||||||
ScopedHandle() = default;
|
ScopedHandle() = default;
|
||||||
ScopedHandle(Handle handle) : mHandle(handle) {}
|
ScopedHandle(Handle handle) : mHandle(handle) {}
|
||||||
~ScopedHandle() { close(mHandle); }
|
~ScopedHandle()
|
||||||
|
{
|
||||||
|
if(mHandle != Handle::Invalid)
|
||||||
|
close(mHandle);
|
||||||
|
}
|
||||||
|
|
||||||
operator Handle() const { return mHandle; }
|
operator Handle() const { return mHandle; }
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user