mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 09:45:36 +00:00
Close only valid handles
This commit is contained in:
parent
2014ea40b9
commit
3c8ef8463c
1 changed files with 5 additions and 1 deletions
|
@ -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 a new issue