From ee612bda3a8fbdbb9515e18a446ddb7c8089b88f Mon Sep 17 00:00:00 2001 From: Camila San Date: Mon, 30 Jul 2018 18:43:41 +0200 Subject: [PATCH] Fixes crash when folder it is not set in the activity list. Signed-off-by: Camila San --- src/gui/activitylistmodel.cpp | 6 ++++-- src/gui/activitywidget.cpp | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/activitylistmodel.cpp b/src/gui/activitylistmodel.cpp index 5bf14524cc..99f817d647 100644 --- a/src/gui/activitylistmodel.cpp +++ b/src/gui/activitylistmodel.cpp @@ -64,12 +64,14 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const case ActivityItemDelegate::PathRole: if(!a._file.isEmpty()){ auto folder = FolderMan::instance()->folder(a._folder); - list = FolderMan::instance()->findFileInLocalFolders(folder->remotePath() + a._file, ast->account()); + QString relPath(a._file); + if(folder) relPath.prepend(folder->remotePath()); + list = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account()); if (list.count() > 0) { return QVariant(list.at(0)); } // File does not exist anymore? Let's try to open its path - list = FolderMan::instance()->findFileInLocalFolders(QFileInfo(folder->remotePath() + a._file).path(), ast->account()); + list = FolderMan::instance()->findFileInLocalFolders(QFileInfo(relPath).path(), ast->account()); if (list.count() > 0) { return QVariant(list.at(0)); } diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp index d6e4472e30..6a1159baaa 100644 --- a/src/gui/activitywidget.cpp +++ b/src/gui/activitywidget.cpp @@ -211,6 +211,8 @@ void ActivityWidget::addError(const QString &folderAlias, const QString &message activity._message = folderInstance->shortGuiLocalPath(); activity._link = folderInstance->shortGuiLocalPath(); activity._accName = folderInstance->accountState()->account()->displayName(); + activity._folder = folderAlias; + if (category == ErrorCategory::InsufficientRemoteStorage) { ActivityLink link;