[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [amarok] src/dynamic/biases: Fix: fix potential crash when album with no tracks for the current trac
From:       Ralf Engels <ralf-engels () gmx ! de>
Date:       2015-02-03 21:08:06
Message-ID: E1YIkha-0002Yd-O0 () scm ! kde ! org
[Download RAW message or body]

Git commit ab52017de4f9c2bc2f8629e7a96104d8bc60688d by Ralf Engels.
Committed on 03/02/2015 at 21:06.
Pushed by rengels into branch 'master'.

Fix: fix potential crash when album with no tracks for the current track

Commented the album play bias a little more
Only actual change: handle the case where for the current track an
album with no tracks is returned (which should not happen at all)

M  +4    -4    src/dynamic/biases/AlbumPlayBias.cpp

http://commits.kde.org/amarok/ab52017de4f9c2bc2f8629e7a96104d8bc60688d

diff --git a/src/dynamic/biases/AlbumPlayBias.cpp \
b/src/dynamic/biases/AlbumPlayBias.cpp index f3e9740..459aab3 100644
--- a/src/dynamic/biases/AlbumPlayBias.cpp
+++ b/src/dynamic/biases/AlbumPlayBias.cpp
@@ -146,19 +146,19 @@ Dynamic::AlbumPlayBias::matchingTracks( const Meta::TrackList& \
playlist,  Q_UNUSED( contextCount );
     Q_UNUSED( finalCount );
 
-    if( playlist.isEmpty() )
+    if( playlist.isEmpty() ) // no track means we can't find any tracks in the same \
album  return Dynamic::TrackSet( universe, false );
 
     Meta::TrackPtr track = playlist.last();
     Meta::AlbumPtr album = track->album();
 
-    if( !album )
+    if( !album ) // no album means we can't find any tracks in the same album
         return Dynamic::TrackSet( universe, false );
 
     Meta::TrackList albumTracks = album->tracks();
 
-    if( albumTracks.count() == 1 ||
-        ( sameTrack( track, albumTracks.last() ) && m_follow != DontCare) )
+    if( ( albumTracks.count() <= 1 ) || // the album has only one track (or even \
less) so there can't be any other tracks in the same album +        ( m_follow != \
DontCare && sameTrack( track, albumTracks.last() ) ) ) // track is the last one and \
we want to find a later one.  return Dynamic::TrackSet( universe, false );
 
     // we assume that the album tracks are sorted by cd and track number which


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic