core/log: fix nullptr crash in ThreadLogging

This commit is contained in:
Derock 2025-08-13 12:52:16 -04:00 committed by outfoxxed
parent 42420ea26d
commit f7597cdae2
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E

View file

@ -458,13 +458,13 @@ void ThreadLogging::onMessage(const LogMessage& msg, bool showInSparse) {
} }
if (!this->detailedWriter.write(msg) || (this->detailedFile && !this->detailedFile->flush())) { if (!this->detailedWriter.write(msg) || (this->detailedFile && !this->detailedFile->flush())) {
this->detailedWriter.setDevice(nullptr);
if (this->detailedFile) { if (this->detailedFile) {
this->detailedFile->close();
this->detailedFile = nullptr;
qCCritical(logLogging) << "Detailed logger failed to write. Ending detailed logs."; qCCritical(logLogging) << "Detailed logger failed to write. Ending detailed logs.";
} }
this->detailedWriter.setDevice(nullptr);
this->detailedFile->close();
this->detailedFile = nullptr;
} }
} }