From 131c1f1bac04a7069ceb903e4ae0709b183a3022 Mon Sep 17 00:00:00 2001 From: Stephan Beyer Date: Sat, 6 Jun 2020 18:04:36 +0200 Subject: [PATCH] Fix crash on opening unconfigured local folder When you try to open the local sync folder (by clicking on the folder symbol) for an account that has no folder configured, the client crashes. This commit changes User::openLocalFolder() to do nothing in case no local folder is configured. Signed-off-by: Stephan Beyer --- src/gui/tray/UserModel.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/tray/UserModel.cpp b/src/gui/tray/UserModel.cpp index 4c3fa4fb5..f0f8b95d2 100644 --- a/src/gui/tray/UserModel.cpp +++ b/src/gui/tray/UserModel.cpp @@ -417,12 +417,16 @@ ActivityListModel *User::getActivityModel() void User::openLocalFolder() { + const auto folder = getFolder(); + + if (folder != nullptr) { #ifdef Q_OS_WIN - QString path = "file:///" + this->getFolder()->path(); + QString path = "file:///" + folder->path(); #else - QString path = "file://" + this->getFolder()->path(); + QString path = "file://" + folder->path(); #endif - QDesktopServices::openUrl(path); + QDesktopServices::openUrl(path); + } } void User::login() const -- 2.30.2