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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user