From e5cef0d7702fc020a2f802e3258eef154faa5631 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 1 Apr 2024 17:59:25 +0800 Subject: [PATCH] Prevent crash on creating debug archive in non-writeable location Signed-off-by: Claudio Cambra --- src/gui/generalsettings.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index 7598d94376c52..4d86c7c06d260 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -109,6 +109,17 @@ QVector createDebugArchiveFileList() void createDebugArchive(const QString &filename) { + const auto fileInfo = QFileInfo(filename); + const auto dirInfo = QFileInfo(fileInfo.dir().absolutePath()); + if (!dirInfo.isWritable()) { + QMessageBox::critical( + nullptr, + QObject::tr("Failed to create debug archive"), + QObject::tr("Could not create debug archive in selected location!") + ); + return; + } + const auto entries = createDebugArchiveFileList(); KZip zip(filename);