From 1dab2c8816b6cd991787d203c1bba2cb52406c63 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 8 Jan 2017 22:50:39 -0500 Subject: [PATCH] IOFile: Correct explicit operator bool semantics The operator void* variant was m_good ? m_file : nullptr; so this was leaving out the file handle check. --- Source/Core/Common/FileUtil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h index ef012ad4ff..755dfcd6e8 100644 --- a/Source/Core/Common/FileUtil.h +++ b/Source/Core/Common/FileUtil.h @@ -211,7 +211,7 @@ public: bool IsOpen() const { return nullptr != m_file; } // m_good is set to false when a read, write or other function fails bool IsGood() const { return m_good; } - explicit operator bool() const { return IsGood(); } + explicit operator bool() const { return IsGood() && IsOpen(); } std::FILE* ReleaseHandle(); std::FILE* GetHandle() { return m_file; }