Commit a324638d authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Album: Consider the list of tracks cached when adding the first one

parent ae2c91ab
......@@ -168,6 +168,13 @@ std::shared_ptr<AlbumTrack> Album::addTrack( std::shared_ptr<Media> media, unsig
auto lock = m_tracks.lock();
// Don't assume we have always have a valid value in m_tracks.
// While it's ok to assume that if we are currently parsing the album, we
// have a valid cache tracks, this isn't true when restarting an interrupted parsing.
// The nbTracks value will be correct however. If it's equal to one, it means we're inserting
// the first track in this album
if ( m_tracks.isCached() == false && m_nbTracks == 1 )
if ( m_tracks.isCached() == true )
m_tracks.get().push_back( media );
return track;
......@@ -33,6 +33,8 @@ public:
bool isCached() const { return m_cached; }
void markCached() { m_cached = true; }
operator T() const
assert( m_cached );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment