diff --git a/src/UI/ViewControllers/DownloadHistory.cpp b/src/UI/ViewControllers/DownloadHistory.cpp index 9c88665..ee8a6c4 100644 --- a/src/UI/ViewControllers/DownloadHistory.cpp +++ b/src/UI/ViewControllers/DownloadHistory.cpp @@ -223,11 +223,13 @@ void ViewControllers::DownloadHistoryViewController::ProcessDownloads(bool force currentEntry->lastUpdate = now; currentEntry->downloadProgress = downloadProgress; - if (currentEntry->UpdateProgressHandler != nullptr) { - BSML::MainThreadScheduler::Schedule([currentEntry] { + + BSML::MainThreadScheduler::Schedule([currentEntry] { + if (currentEntry->UpdateProgressHandler != nullptr) { currentEntry->UpdateProgressHandler(); - }); - } + } + }); + DEBUG("DownloadProgress: {}", downloadProgress); }; DEBUG("Hash {}", currentEntry->hash); diff --git a/src/UI/ViewControllers/DownloadHistoryCell.cpp b/src/UI/ViewControllers/DownloadHistoryCell.cpp index 9843397..e5d9e0e 100644 --- a/src/UI/ViewControllers/DownloadHistoryCell.cpp +++ b/src/UI/ViewControllers/DownloadHistoryCell.cpp @@ -56,6 +56,9 @@ namespace BetterSongSearch::UI::ViewControllers { } void CustomDownloadListTableCell::WasPreparedForReuse() { + if (!entry) { + return; + } entry->UpdateProgressHandler = nullptr; } } // namespace BetterSongSearch::UI::ViewControllers diff --git a/src/UI/ViewControllers/SongList.cpp b/src/UI/ViewControllers/SongList.cpp index d58a86b..b94ddab 100644 --- a/src/UI/ViewControllers/SongList.cpp +++ b/src/UI/ViewControllers/SongList.cpp @@ -243,7 +243,7 @@ void ViewControllers::SongListController::SelectSong(UnityW tab return; } DEBUG("Cell clicked {}", id); - if (dataHolder.displayedSongList.size() <= id) { + if (dataHolder.displayedSongList.size() <= id || id < 0) { // Return if the id is invalid return; }