1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

Add a small guard to Artist::get and Album::get as they are called all over, and might be called after destruction of DB on shutdown

This commit is contained in:
Leo Franchi
2012-03-06 18:47:55 -05:00
parent 34672c7bed
commit 89009c09be
2 changed files with 6 additions and 0 deletions

View File

@@ -38,6 +38,9 @@ Album::~Album()
album_ptr album_ptr
Album::get( const Tomahawk::artist_ptr& artist, const QString& name, bool autoCreate ) Album::get( const Tomahawk::artist_ptr& artist, const QString& name, bool autoCreate )
{ {
if ( !Database::instance() || !Database::instance()->impl() )
return album_ptr();
int albid = Database::instance()->impl()->albumId( artist->id(), name, autoCreate ); int albid = Database::instance()->impl()->albumId( artist->id(), name, autoCreate );
if ( albid < 1 && autoCreate ) if ( albid < 1 && autoCreate )
return album_ptr(); return album_ptr();

View File

@@ -38,6 +38,9 @@ Artist::~Artist()
artist_ptr artist_ptr
Artist::get( const QString& name, bool autoCreate ) Artist::get( const QString& name, bool autoCreate )
{ {
if ( !Database::instance() || !Database::instance()->impl() )
return artist_ptr();
int artid = Database::instance()->impl()->artistId( name, autoCreate ); int artid = Database::instance()->impl()->artistId( name, autoCreate );
if ( artid < 1 && autoCreate ) if ( artid < 1 && autoCreate )
return artist_ptr(); return artist_ptr();