fix: do not write log if file handler is bad (#5675)

This commit is contained in:
Geoffrey Bonneville 2023-06-27 11:44:10 -07:00 committed by GitHub
parent 2db2091599
commit 7fdfabe184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -164,6 +164,11 @@ void logAddImpl(
if (fp == TR_BAD_SYS_FILE)
{
fp = tr_sys_file_get_std(TR_STD_SYS_FILE_ERR);
// if fp is still bad, do not write log
if (fp == TR_BAD_SYS_FILE)
{
return;
}
}
auto timestr = std::array<char, 64>{};