1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-07 06:36:55 +02:00

TWK-415: Don't crash if the trackproxymodel has an invalid current track

This commit is contained in:
Leo Franchi
2011-08-19 15:45:21 -04:00
parent f0a6d4e8bb
commit 498d7052de
2 changed files with 2 additions and 2 deletions

View File

@@ -212,7 +212,7 @@ AudioEngine::canGoNext()
return false; return false;
if ( !m_currentTrack.isNull() && !m_playlist.data()->hasNextItem() && if ( !m_currentTrack.isNull() && !m_playlist.data()->hasNextItem() &&
m_currentTrack->id() == m_playlist.data()->currentItem()->id() ) ( m_playlist.data()->currentItem().isNull() || ( m_currentTrack->id() == m_playlist.data()->currentItem()->id() ) ) )
{ {
//For instance, when doing a catch-up while listening along, but the person //For instance, when doing a catch-up while listening along, but the person
//you're following hasn't started a new track yet...don't do anything //you're following hasn't started a new track yet...don't do anything

View File

@@ -177,7 +177,7 @@ Tomahawk::result_ptr
TrackProxyModel::currentItem() const TrackProxyModel::currentItem() const
{ {
TrackModelItem* item = itemFromIndex( mapToSource( currentIndex() ) ); TrackModelItem* item = itemFromIndex( mapToSource( currentIndex() ) );
if ( item && item->query()->playable() ) if ( item && !item->query().isNull() && item->query()->playable() )
return item->query()->results().at( 0 ); return item->query()->results().at( 0 );
return Tomahawk::result_ptr(); return Tomahawk::result_ptr();
} }