Main: check if database exists before attempting to close it

Fixes nullptr dereference.
This commit is contained in:
Max Kellermann 2014-02-17 22:13:39 +01:00
parent 6da0af94df
commit ff62b6742b

View File

@ -595,8 +595,11 @@ int mpd_main(int argc, char *argv[])
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
delete instance->update; delete instance->update;
instance->database->Close();
delete instance->database; if (instance->database != nullptr) {
instance->database->Close();
delete instance->database;
}
#endif #endif
#ifdef ENABLE_SQLITE #ifdef ENABLE_SQLITE