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.
This commit is contained in:
Lioncash 2017-01-08 22:50:39 -05:00
parent 0869c63048
commit 1dab2c8816
1 changed files with 1 additions and 1 deletions

View File

@ -211,7 +211,7 @@ public:
bool IsOpen() const { return nullptr != m_file; } bool IsOpen() const { return nullptr != m_file; }
// m_good is set to false when a read, write or other function fails // m_good is set to false when a read, write or other function fails
bool IsGood() const { return m_good; } bool IsGood() const { return m_good; }
explicit operator bool() const { return IsGood(); } explicit operator bool() const { return IsGood() && IsOpen(); }
std::FILE* ReleaseHandle(); std::FILE* ReleaseHandle();
std::FILE* GetHandle() { return m_file; } std::FILE* GetHandle() { return m_file; }