From 35d4f91b42f7b468bfe01ee160900f419b409a90 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Mon, 7 Oct 2024 14:16:50 +0200 Subject: [PATCH] ensure log context category is valid before reading it category of logs accessed via log context can be null in such a case, strcmp will crash Signed-off-by: Matthieu Gallien --- src/libsync/logger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsync/logger.cpp b/src/libsync/logger.cpp index 5e84be48ac0d7..86f482fffe490 100644 --- a/src/libsync/logger.cpp +++ b/src/libsync/logger.cpp @@ -148,7 +148,7 @@ void Logger::doLog(QtMsgType type, const QMessageLogContext &ctx, const QString if (_doFileFlush) _logstream->flush(); } - if (_permanentDeleteLogStream && strcmp(ctx.category, lcPermanentLog().categoryName()) == 0) { + if (_permanentDeleteLogStream && ctx.category && strcmp(ctx.category, lcPermanentLog().categoryName()) == 0) { (*_permanentDeleteLogStream) << msg << "\n"; _permanentDeleteLogStream->flush(); if (_permanentDeleteLogFile.size() > 10LL * 1024LL) {