aboutsummaryrefslogtreecommitdiffstats
path: root/src/Main.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-17 22:12:33 +0100
committerMax Kellermann <max@duempel.org>2014-02-17 22:14:00 +0100
commit91729437a0c24c5aad8f223f64ee63e918fe8b91 (patch)
treeb68c0e574d60e9395de75ac3761968e6104fc98f /src/Main.cxx
parent3af7af0b8fe603ab5c45f2cf3d89cb6ca017c40e (diff)
downloadmpd-91729437a0c24c5aad8f223f64ee63e918fe8b91.tar.gz
mpd-91729437a0c24c5aad8f223f64ee63e918fe8b91.tar.xz
mpd-91729437a0c24c5aad8f223f64ee63e918fe8b91.zip
Main: initialize Database before Storage
Diffstat (limited to '')
-rw-r--r--src/Main.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/Main.cxx b/src/Main.cxx
index 23f1659d7..2657d54f1 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -172,7 +172,6 @@ glue_db_init_and_load(void)
Error error;
instance->database =
CreateConfiguredDatabase(*instance->event_loop, *instance,
- instance->storage != nullptr,
is_simple, error);
if (instance->database == nullptr) {
if (error.IsDefined())
@@ -181,6 +180,18 @@ glue_db_init_and_load(void)
return true;
}
+ if (!InitStorage(error))
+ FatalError(error);
+
+ if (instance->storage == nullptr) {
+ delete instance->database;
+ instance->database = nullptr;
+ LogDefault(config_domain,
+ "Found database setting without "
+ "music_directory - disabling database");
+ return true;
+ }
+
if (!instance->database->Open(error))
FatalError(error);
@@ -199,10 +210,6 @@ glue_db_init_and_load(void)
static bool
InitDatabaseAndStorage()
{
- Error error;
- if (!InitStorage(error))
- FatalError(error);
-
const bool create_db = !glue_db_init_and_load();
return create_db;
}