diff options
author | Max Kellermann <max@duempel.org> | 2011-09-13 20:54:27 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-09-13 20:54:27 +0200 |
commit | b4430839a3413893a027f7a0fc5494af8198e1bb (patch) | |
tree | c35a7d8ba0c12b84b4b9af7385a989e15a27698b /src/database.c | |
parent | 412cf974a4cf3693cc643ab8ce0c1d733b7e8047 (diff) | |
download | mpd-b4430839a3413893a027f7a0fc5494af8198e1bb.tar.gz mpd-b4430839a3413893a027f7a0fc5494af8198e1bb.tar.xz mpd-b4430839a3413893a027f7a0fc5494af8198e1bb.zip |
database: generate GError when database is disabled
Diffstat (limited to '')
-rw-r--r-- | src/database.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/database.c b/src/database.c index d93066389..cb79c1d39 100644 --- a/src/database.c +++ b/src/database.c @@ -27,6 +27,7 @@ #include "directory.h" #include "stats.h" #include "conf.h" +#include "glib_compat.h" #include <glib.h> @@ -112,12 +113,14 @@ db_walk(const char *uri, const struct db_visitor *visitor, void *ctx, GError **error_r) { - struct directory *directory; - - if (db == NULL) - return -1; + if (db == NULL) { + g_set_error_literal(error_r, db_quark(), DB_DISABLED, + "No database"); + return false; + } - if ((directory = db_get_directory(uri)) == NULL) { + struct directory *directory = db_get_directory(uri); + if (directory == NULL) { struct song *song; if (visitor->song != NULL && (song = db_get_song(uri)) != NULL) |