Skip to content

Commit

Permalink
Merge pull request #79436 from alef/79433-fix
Browse files Browse the repository at this point in the history
Check if debug.log exists
  • Loading branch information
Maleclypse authored Jan 31, 2025
2 parents f510ba6 + 2d2a3b9 commit 08f25b0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,8 @@ void DebugFile::init( DebugOutput output_mode, const cata_path &filename )
this->filename = filename;
// Continue with the old log file if it's smaller than 1 MiB
namespace fs = std::filesystem;
if( fs::file_size( fs::path( filename ) ) >= 1024 * 1024 ) {
if( fs::exists( fs::path( filename ) )
&& fs::file_size( fs::path( filename ) ) >= 1024 * 1024 ) {
std::error_code ec;
fs::rename( fs::path( filename ), fs::path( oldfile ), ec );
rename_failed = bool( ec );
Expand Down

0 comments on commit 08f25b0

Please sign in to comment.