Skip to content

Commit ce2068f

Browse files
committed
Address PR feedback: fix redundant check and move refresh outside try catch.
1 parent 3253747 commit ce2068f

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/downloadmanager.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -907,9 +907,9 @@ void DownloadManager::restoreDownload(int index)
907907

908908
void DownloadManager::removeDownload(int index, bool deleteFile)
909909
{
910-
// validate the single-index case before entering the guard so we don't
911-
// emit an empty reset on early return
912-
if (index >= 0 && index >= m_ActiveDownloads.size()) {
910+
// validate before entering the guard so we don't emit an empty reset on
911+
// early return
912+
if (index >= m_ActiveDownloads.size()) {
913913
reportError(tr("remove: invalid download index %1").arg(index));
914914
return;
915915
}
@@ -942,11 +942,11 @@ void DownloadManager::removeDownload(int index, bool deleteFile)
942942
delete m_ActiveDownloads.at(index);
943943
m_ActiveDownloads.erase(m_ActiveDownloads.begin() + index);
944944
}
945-
946-
refreshList();
947945
} catch (const std::exception& e) {
948946
log::error("failed to remove download: {}", e.what());
949947
}
948+
949+
refreshList();
950950
}
951951

952952
void DownloadManager::cancelDownload(int index)

0 commit comments

Comments
 (0)