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
|
@ -116,7 +116,8 @@ public:
|
||||||
void ClearError()
|
void ClearError()
|
||||||
{
|
{
|
||||||
m_good = true;
|
m_good = true;
|
||||||
std::clearerr(m_file);
|
if (IsOpen())
|
||||||
|
std::clearerr(m_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue