From 98e41d012a771910097b978a4e45aeeeaa98885e Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Mon, 6 Jun 2011 12:04:11 +0000 Subject: [PATCH] Fix crash in backup widget, don't open a file if it is not a Kdenlive project svn path=/trunk/kdenlive/; revision=5668 --- src/databackup/backupwidget.cpp | 5 +++++ src/mainwindow.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/databackup/backupwidget.cpp b/src/databackup/backupwidget.cpp index b38152b6..cf862656 100644 --- a/src/databackup/backupwidget.cpp +++ b/src/databackup/backupwidget.cpp @@ -68,6 +68,7 @@ void BackupWidget::slotParseBackupFiles() dir.setNameFilters(filter); QFileInfoList resultList = dir.entryInfoList(QDir::Files, QDir::Time); QStringList results; + backup_list->clear(); QListWidgetItem *item; for (int i = 0; i < resultList.count(); i++) { item = new QListWidgetItem(resultList.at(i).lastModified().toString(Qt::DefaultLocaleLongDate), backup_list); @@ -77,6 +78,10 @@ void BackupWidget::slotParseBackupFiles() void BackupWidget::slotDisplayBackupPreview() { + if (!backup_list->currentItem()) { + backup_preview->setPixmap(QPixmap()); + return; + } QString path = backup_list->currentItem()->data(Qt::UserRole).toString(); QPixmap pix(path + ".png"); backup_preview->setPixmap(pix); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 54ed5506..902e8519 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1960,6 +1960,11 @@ void MainWindow::openFile(const KUrl &url) delete ar; return; } + if (!url.fileName().endsWith(".kdenlive")) { + // This is not a Kdenlive project file, abort loading + KMessageBox::sorry(this, i18n("File %1 is not a Kdenlive project file", url.path())); + return; + } // Check if the document is already opened const int ct = m_timelineArea->count(); -- 2.39.2