mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* Fixed crashes in DbCmd_SetPlaylistRevision.
This commit is contained in:
@@ -80,7 +80,6 @@ DatabaseCommand_SetPlaylistRevision::DatabaseCommand_SetPlaylistRevision(
|
|||||||
tmp << s;
|
tmp << s;
|
||||||
|
|
||||||
setOrderedguids( tmp );
|
setOrderedguids( tmp );
|
||||||
|
|
||||||
setPlaylistguid( playlistguid );
|
setPlaylistguid( playlistguid );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +99,6 @@ DatabaseCommand_SetPlaylistRevision::postCommitHook()
|
|||||||
playlist_ptr playlist = source()->collection()->playlist( m_playlistguid );
|
playlist_ptr playlist = source()->collection()->playlist( m_playlistguid );
|
||||||
if ( playlist.isNull() )
|
if ( playlist.isNull() )
|
||||||
{
|
{
|
||||||
qDebug() << m_playlistguid;
|
|
||||||
Q_ASSERT( !playlist.isNull() );
|
Q_ASSERT( !playlist.isNull() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -150,7 +148,9 @@ DatabaseCommand_SetPlaylistRevision::exec( DatabaseImpl* lib )
|
|||||||
|
|
||||||
foreach( const plentry_ptr& e, m_entries )
|
foreach( const plentry_ptr& e, m_entries )
|
||||||
{
|
{
|
||||||
if ( e->query()->results().isEmpty() )
|
if ( !e->isValid() )
|
||||||
|
continue;
|
||||||
|
if ( !e->query()->numResults() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
adde.bindValue( 0, e->query()->results().first()->url() );
|
adde.bindValue( 0, e->query()->results().first()->url() );
|
||||||
@@ -167,6 +167,9 @@ DatabaseCommand_SetPlaylistRevision::exec( DatabaseImpl* lib )
|
|||||||
|
|
||||||
foreach( const plentry_ptr& e, m_entries )
|
foreach( const plentry_ptr& e, m_entries )
|
||||||
{
|
{
|
||||||
|
if ( !e->isValid() )
|
||||||
|
continue;
|
||||||
|
|
||||||
adde.bindValue( 0, e->query()->track() );
|
adde.bindValue( 0, e->query()->track() );
|
||||||
adde.bindValue( 1, e->query()->artist() );
|
adde.bindValue( 1, e->query()->artist() );
|
||||||
adde.bindValue( 2, e->query()->album() );
|
adde.bindValue( 2, e->query()->album() );
|
||||||
@@ -189,6 +192,9 @@ DatabaseCommand_SetPlaylistRevision::exec( DatabaseImpl* lib )
|
|||||||
qDebug() << "Num new playlist_items to add:" << m_addedentries.length();
|
qDebug() << "Num new playlist_items to add:" << m_addedentries.length();
|
||||||
foreach( const plentry_ptr& e, m_addedentries )
|
foreach( const plentry_ptr& e, m_addedentries )
|
||||||
{
|
{
|
||||||
|
if ( !e->isValid() )
|
||||||
|
continue;
|
||||||
|
|
||||||
// qDebug() << "Adding:" << e->guid() << e->query()->track() << e->query()->artist();
|
// qDebug() << "Adding:" << e->guid() << e->query()->track() << e->query()->artist();
|
||||||
|
|
||||||
m_addedmap.insert( e->guid(), e ); // needed in postcommithook
|
m_addedmap.insert( e->guid(), e ); // needed in postcommithook
|
||||||
|
@@ -77,9 +77,11 @@ public:
|
|||||||
m_addedentries.clear();
|
m_addedentries.clear();
|
||||||
foreach( const QVariant& v, vlist )
|
foreach( const QVariant& v, vlist )
|
||||||
{
|
{
|
||||||
PlaylistEntry * pep = new PlaylistEntry;
|
PlaylistEntry* pep = new PlaylistEntry;
|
||||||
QJson::QObjectHelper::qvariant2qobject( v.toMap(), pep );
|
QJson::QObjectHelper::qvariant2qobject( v.toMap(), pep );
|
||||||
m_addedentries << plentry_ptr(pep);
|
|
||||||
|
if ( pep->isValid() )
|
||||||
|
m_addedentries << plentry_ptr( pep );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +90,9 @@ public:
|
|||||||
QVariantList vlist;
|
QVariantList vlist;
|
||||||
foreach( const plentry_ptr& pe, m_addedentries )
|
foreach( const plentry_ptr& pe, m_addedentries )
|
||||||
{
|
{
|
||||||
|
if ( !pe->isValid() )
|
||||||
|
continue;
|
||||||
|
|
||||||
QVariant v = QJson::QObjectHelper::qobject2qvariant( pe.data() );
|
QVariant v = QJson::QObjectHelper::qobject2qvariant( pe.data() );
|
||||||
vlist << v;
|
vlist << v;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user