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