Fixed a bug in TrackList.cpp when trying to change tracks in an empty

playback queue.
This commit is contained in:
casey langen 2017-02-25 22:49:25 -08:00
parent ca60a66b8f
commit aac7dd3632
2 changed files with 18 additions and 11 deletions

View File

@ -1,5 +1,6 @@
0.9.1 0.9.1
* added an app icon on win32 and android builds
* added proper support for using and switching between different audio sample * added proper support for using and switching between different audio sample
formats. 24/192k works across all platforms now. formats. 24/192k works across all platforms now.
* fixed `DirectSoundOut` pause to work properly again * fixed `DirectSoundOut` pause to work properly again
@ -7,6 +8,7 @@
macOS binaries that don't require homebrew! let's try to keep it that way. macOS binaries that don't require homebrew! let's try to keep it that way.
* updated some defaults -- rescan metadata on startup by default, and restrict * updated some defaults -- rescan metadata on startup by default, and restrict
to two processing threads. to two processing threads.
* fixed a crash when trying to change tracks in an empty playlist queue
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@ -125,19 +125,24 @@ bool TrackList::Delete(size_t index) {
} }
TrackPtr TrackList::Get(size_t index) const { TrackPtr TrackList::Get(size_t index) const {
auto id = this->ids.at(index); try {
auto cached = this->GetFromCache(id); auto id = this->ids.at(index);
auto cached = this->GetFromCache(id);
if (cached) { if (cached) {
return cached; return cached;
}
std::shared_ptr<TrackMetadataQuery> query(
new TrackMetadataQuery(id, this->library));
this->library->Enqueue(query, ILibrary::QuerySynchronous);
this->AddToCache(id, query->Result());
return query->Result();
}
catch (...) {
return TrackPtr();
} }
std::shared_ptr<TrackMetadataQuery> query(
new TrackMetadataQuery(id, this->library));
this->library->Enqueue(query, ILibrary::QuerySynchronous);
this->AddToCache(id, query->Result());
return query->Result();
} }
IRetainedTrack* TrackList::GetRetainedTrack(size_t index) const { IRetainedTrack* TrackList::GetRetainedTrack(size_t index) const {