]> git.sesse.net Git - kdenlive/commitdiff
Fix crash in backup widget, don't open a file if it is not a Kdenlive project
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 6 Jun 2011 12:04:11 +0000 (12:04 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 6 Jun 2011 12:04:11 +0000 (12:04 +0000)
svn path=/trunk/kdenlive/; revision=5668

src/databackup/backupwidget.cpp
src/mainwindow.cpp

index b38152b61d5d93fb7cb61129f0ccc7b91ea82e37..cf862656fe39cb0e77d7cac8aa78b62da89dfbf0 100644 (file)
@@ -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);
index 54ed5506ede8a1c314a74fde015101250268dd28..902e8519872dc85c66aa4bc9feff547554afdc3e 100644 (file)
@@ -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();