Commit ff62b674 authored by Max Kellermann's avatar Max Kellermann

Main: check if database exists before attempting to close it

Fixes nullptr dereference.
parent 6da0af94
...@@ -595,8 +595,11 @@ int mpd_main(int argc, char *argv[]) ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment