Fixes crash when folder it is not set in the activity list.

Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
Camila San 2018-07-30 18:43:41 +02:00
parent a1cab471e8
commit ee612bda3a
No known key found for this signature in database
GPG Key ID: 7A4A6121E88E2AD4
2 changed files with 6 additions and 2 deletions

View File

@ -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));
}

View File

@ -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;