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:
@@ -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();
|
||||||
|
@@ -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();
|
||||||
|
Reference in New Issue
Block a user