]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/windows/handle.cpp
Avoid closing handles twice
[libs/core.git] / source / io / windows / handle.cpp
index 5b1d93368f3386adeab823b1c67c121a1cbd3264..17aabb080bb113c3e8e35a59f5cb7ae2f5fdafef 100644 (file)
@@ -35,7 +35,11 @@ unsigned sys_write(Handle &handle, const char *buf, unsigned size)
 
 void sys_close(Handle &handle)
 {
-       CloseHandle(*handle);
+       if(handle)
+       {
+               CloseHandle(*handle);
+               *handle = INVALID_HANDLE_VALUE;
+       }
 }
 
 } // namespace IO