Don't crash if the current track source encounters a record with no id

This *shouldn't* normally happen, but it's not worth crashing over.
This commit is contained in:
jacqueline
2023-10-20 12:44:52 +11:00
parent c27880282a
commit a8b866aafe
2 changed files with 8 additions and 3 deletions
+2
View File
@@ -100,6 +100,7 @@ auto TrackQueue::AddNext(std::shared_ptr<playlist::ISource> src) -> void {
auto TrackQueue::IncludeNext(std::shared_ptr<playlist::IResetableSource> src)
-> void {
assert(src.get() != nullptr);
const std::lock_guard<std::mutex> lock(mutex_);
enqueued_.push_front(src);
@@ -128,6 +129,7 @@ auto TrackQueue::AddLast(std::shared_ptr<playlist::ISource> src) -> void {
auto TrackQueue::IncludeLast(std::shared_ptr<playlist::IResetableSource> src)
-> void {
assert(src.get() != nullptr);
const std::lock_guard<std::mutex> lock(mutex_);
enqueued_.push_back(src);
+6 -3
View File
@@ -139,9 +139,12 @@ auto IndexRecordSource::Peek(std::size_t n, std::vector<database::TrackId>* out)
working_item = 0;
}
out->push_back(working_page->values().at(working_item)->track().value());
n--;
items_added++;
auto record = working_page->values().at(working_item);
if (record->track()) {
out->push_back(record->track().value());
n--;
items_added++;
}
working_item++;
}