From 38b13d710c11759a8c2c46ccde37fcc166554a0e Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Fri, 28 Apr 2023 10:36:26 +0200 Subject: [PATCH] fix(GODT-2596): fix bug when trying to generate Sentry report and there is not log. --- .../frontend/bridge-gui/bridgepp/bridgepp/Log/LogUtils.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/Log/LogUtils.cpp b/internal/frontend/bridge-gui/bridgepp/bridgepp/Log/LogUtils.cpp index eb825792..bca90da8 100644 --- a/internal/frontend/bridge-gui/bridgepp/bridgepp/Log/LogUtils.cpp +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/Log/LogUtils.cpp @@ -43,7 +43,12 @@ QString latestBridgeLogPath() { if (logsDir.isEmpty()) { return QString(); } + QFileInfoList files = logsDir.entryInfoList({ "v*.log" }, QDir::Files); // could do sorting, but only by last modification time. we want to sort by creation time. + if (files.isEmpty()) { + return QString(); + } + std::sort(files.begin(), files.end(), [](QFileInfo const &lhs, QFileInfo const &rhs) -> bool { return lhs.birthTime() < rhs.birthTime(); });