1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-24 01:39:42 +01: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;
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
//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
{
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 Tomahawk::result_ptr();
}