Fix crash on opening unconfigured local folder
authorStephan Beyer <s-beyer@gmx.net>
Sat, 6 Jun 2020 16:04:36 +0000 (18:04 +0200)
committerStephan Beyer <s-beyer@gmx.net>
Tue, 9 Jun 2020 14:45:38 +0000 (16:45 +0200)
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 <s-beyer@gmx.net>
src/gui/tray/UserModel.cpp

index 4c3fa4fb55143634629a66ef7c7ae818749f63fd..f0f8b95d2abbbf372d766a545f46c66f5f4008c3 100644 (file)
@@ -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