From b843dab87a2fb851ca60b97bd80bc589e3963728 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 27 Jan 2024 00:27:41 +0400 Subject: [PATCH] Get error message from the right object when copying log file --- Telegram/SourceFiles/logs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index 3096a8c9f..9a04542ef 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -151,8 +151,8 @@ private: LOG(("Could not delete '%1' file to start new logging: %2").arg(to->fileName(), to->errorString())); return false; } - if (!QFile(files[type]->fileName()).copy(to->fileName())) { // don't close files[type] yet - LOG(("Could not copy '%1' to '%2' to start new logging: %3").arg(files[type]->fileName(), to->fileName(), to->errorString())); + if (auto from = QFile(files[type]->fileName()); !from.copy(to->fileName())) { // don't close files[type] yet + LOG(("Could not copy '%1' to '%2' to start new logging: %3").arg(files[type]->fileName(), to->fileName(), from.errorString())); return false; } if (to->open(mode | QIODevice::Append)) {