From c6bc264b35777f7d1ebdb6168f6f82c1f3378b71 Mon Sep 17 00:00:00 2001
From: Matt <3397065-ZehMatt@users.noreply.gitlab.com>
Date: Tue, 19 Jul 2022 13:48:57 +0000
Subject: [PATCH] Use correct assertion for the file implementation

---
 components/platform/file.posix.cpp | 3 +++
 components/platform/file.stdio.cpp | 3 +++
 components/platform/file.win32.cpp | 5 +++--
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/components/platform/file.posix.cpp b/components/platform/file.posix.cpp
index efffa0fd76..f79562dcfd 100644
--- a/components/platform/file.posix.cpp
+++ b/components/platform/file.posix.cpp
@@ -7,11 +7,14 @@
 #include <string.h>
 #include <stdexcept>
 #include <string>
+#include <cassert>
 
 namespace Platform::File {
 
     static auto getNativeHandle(Handle handle)
     {
+        assert(handle != Handle::Invalid);
+
         return static_cast<int>(handle);
     }
 
diff --git a/components/platform/file.stdio.cpp b/components/platform/file.stdio.cpp
index 26c2480902..558fea1154 100644
--- a/components/platform/file.stdio.cpp
+++ b/components/platform/file.stdio.cpp
@@ -4,11 +4,14 @@
 #include <string.h>
 #include <string>
 #include <stdexcept>
+#include <cassert>
 
 namespace Platform::File {
 
     static auto getNativeHandle(Handle handle)
     {
+        assert(handle != Handle::Invalid);
+
         return reinterpret_cast<FILE*>(static_cast<intptr_t>(handle));
     }
 
diff --git a/components/platform/file.win32.cpp b/components/platform/file.win32.cpp
index ad7e11213d..a2ba86a4ef 100644
--- a/components/platform/file.win32.cpp
+++ b/components/platform/file.win32.cpp
@@ -4,11 +4,14 @@
 #include <string>
 #include <stdexcept>
 #include <boost/locale.hpp>
+#include <cassert>
 
 namespace Platform::File {
 
     static auto getNativeHandle(Handle handle)
     {
+        assert(handle != Handle::Invalid);
+
         return reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle));
     }
 
@@ -58,8 +61,6 @@ namespace Platform::File {
     {
         auto nativeHandle = getNativeHandle(handle);
 
-        assert(isValidHandle(mHandle));
-
         BY_HANDLE_FILE_INFORMATION info;
 
         if (!GetFileInformationByHandle(nativeHandle, &info))