mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-24 22:34:54 +00:00
IOFile: avoid clearing errors on null file struct
When performing a default compilation with recent GCC & glibc, the use of -Werror=nonnull causes a build error. The error is given as IOFile::ClearError() can call std::clearerr() with a null file, which can trigger a null-pointer dereference in libc. Change the std::clearerr() call to be conditional on a file being open.
This commit is contained in:
parent
aa66842172
commit
3da2e15e6b
1 changed files with 2 additions and 1 deletions
|
@ -116,6 +116,7 @@ public:
|
|||
void ClearError()
|
||||
{
|
||||
m_good = true;
|
||||
if (IsOpen())
|
||||
std::clearerr(m_file);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue