1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-01 14:42:25 +02:00

Fix another crash related to debug accessing null pointers

This commit is contained in:
Jeff Mitchell 2012-06-29 10:05:55 -04:00
parent 028f6b969e
commit ca22cfd31d

View File

@ -111,11 +111,18 @@ DatabaseCommand_SetDynamicPlaylistRevision::postCommitHook()
if( playlist.isNull() ) // if it's neither an auto or station, it must not be auto-loaded, so we MUST have been told about it directly
rawPl = m_playlist;
if ( rawPl == 0 )
{
tLog() <<"Got null playlist with guid:" << playlistguid() << "from source and collection:" << source()->friendlyName() << source()->collection()->name() << "and mode is static?:" << (m_mode == Static);
Q_ASSERT( false );
return;
}
// workaround a bug in pre-0.1.0 tomahawks. they created dynamic playlists in OnDemand mode *always*, and then set the mode to the real one.
// now that we separate them, if we get them as one and then get a changed mode, the playlist ends up in the wrong bucket in Collection.
// so here we fix it if we have to.
// HACK
tDebug() << "Does this need the 0.3->0.1 playlist category hack fix?" << ( rawPl->mode() == Static && source()->collection()->autoPlaylist( playlistguid() ).isNull() )
tDebug() << "Does this need the 0.3->0.1 playlist category hack fix?" << ( rawPl->mode() == Static && source()->collection()->autoPlaylist( playlistguid() ).isNull() )
<< ( rawPl->mode() == OnDemand && source()->collection()->station( playlistguid() ).isNull() )
<< rawPl->mode() << source()->collection()->autoPlaylist( playlistguid() ).isNull() << source()->collection()->station( playlistguid() ).isNull();
if( rawPl->mode() == Static && source()->collection()->autoPlaylist( playlistguid() ).isNull() ) // should be here
@ -123,13 +130,7 @@ DatabaseCommand_SetDynamicPlaylistRevision::postCommitHook()
else if ( rawPl->mode() == OnDemand && source()->collection()->station( playlistguid() ).isNull() ) // should be here
source()->collection()->moveAutoToStation( playlistguid() );
if ( rawPl == 0 )
{
tLog() <<"Got null playlist with guid:" << playlistguid() << "from source and collection:" << source()->friendlyName() << source()->collection()->name() << "and mode is static?:" << (m_mode == Static);
Q_ASSERT( false );
return;
}
if ( !m_controlsV.isEmpty() && m_controls.isEmpty() )
if ( !m_controlsV.isEmpty() && m_controls.isEmpty() )
{
QList<QVariantMap> controlMap;
foreach( const QVariant& v, m_controlsV )