The operator void* variant was m_good ? m_file : nullptr; so this was leaving out the file handle check.