Commit 352c20df authored by Ralf Engels's avatar Ralf Engels
Browse files

Fix some more playlist related problems.

The assumption was that a playlist always contains valid tracks.
However that does not seem to be the case.

Scenario: Tracks are deleted from collection but not from playlist.

So, when handling playlist tracks, make sure that there is an actual
track object behind it.

BUG: 302607
FIXED-IN: 2.6
parent 217fbb7b
......@@ -2,12 +2,12 @@ Amarok ChangeLog
================
(C) 2002-2012 the Amarok authors.
VERSION 2.7
VERSION 2.6
CHANGES:
BUGFIXES:
* Fix problems when sql server is not reachable (BR 298425)
* Fix crash with exporting playlists with invalid tracks (BR 303056)
* Fix crash with exporting playlists with invalid tracks (BR 303056 and BR 302607)
VERSION 2.6-RC
CHANGES:
......
......@@ -317,6 +317,9 @@ PLSPlaylist::save( const KUrl &location, bool relative )
int i = 1; //PLS starts at File1=
foreach( Meta::TrackPtr track, m_tracks )
{
if( !track ) // see BUG: 303056
continue;
KUrl playableUrl( track->playableUrl() );
QString file = playableUrl.url();
......
......@@ -266,6 +266,8 @@ XSPFPlaylist::triggerTrackLoad()
void
XSPFPlaylist::addTrack( Meta::TrackPtr track, int position )
{
if( !track ) // playlists might contain invalid tracks. see BUG: 303056
return;
Meta::TrackList trackList = tracks();
int trackPos = position < 0 ? trackList.count() : position;
......
......@@ -58,6 +58,8 @@ Playlist::TrackNavigator::queueIds( const QList<quint64> &ids )
foreach( quint64 id, ids )
{
track = m_model->trackForId( id );
if( !track ) // playlist might contain invalid tracks. See BUG: 302607
continue;
if( !m_queue.contains( id ) && track->isPlayable() )
m_queue.enqueue( id );
}
......
Supports Markdown
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