Fix crash on multi-selection download/delete action

Solves #16
This commit is contained in:
Bart De Vries 2021-09-23 13:17:06 +02:00
parent bd1cf2c5f0
commit 8900186990

View File

@ -621,9 +621,11 @@ void DataManager::bulkDownloadEnclosures(QStringList list)
{ {
bulkQueueStatus(true, list); bulkQueueStatus(true, list);
for (QString id : list) { for (QString id : list) {
if (getEntry(id)->hasEnclosure()) {
getEntry(id)->enclosure()->download(); getEntry(id)->enclosure()->download();
} }
} }
}
void DataManager::bulkDeleteEnclosuresByIndex(QModelIndexList list) void DataManager::bulkDeleteEnclosuresByIndex(QModelIndexList list)
{ {
@ -634,8 +636,10 @@ void DataManager::bulkDeleteEnclosures(QStringList list)
{ {
Database::instance().execute(QStringLiteral("BEGIN TRANSACTION;")); Database::instance().execute(QStringLiteral("BEGIN TRANSACTION;"));
for (QString id : list) { for (QString id : list) {
if (getEntry(id)->hasEnclosure()) {
getEntry(id)->enclosure()->deleteFile(); getEntry(id)->enclosure()->deleteFile();
} }
}
Database::instance().execute(QStringLiteral("COMMIT;")); Database::instance().execute(QStringLiteral("COMMIT;"));
} }