aboutsummaryrefslogtreecommitdiffstats
path: root/src/database.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-13 20:54:27 +0200
committerMax Kellermann <max@duempel.org>2011-09-13 20:54:27 +0200
commitb4430839a3413893a027f7a0fc5494af8198e1bb (patch)
treec35a7d8ba0c12b84b4b9af7385a989e15a27698b /src/database.c
parent412cf974a4cf3693cc643ab8ce0c1d733b7e8047 (diff)
downloadmpd-b4430839a3413893a027f7a0fc5494af8198e1bb.tar.gz
mpd-b4430839a3413893a027f7a0fc5494af8198e1bb.tar.xz
mpd-b4430839a3413893a027f7a0fc5494af8198e1bb.zip
database: generate GError when database is disabled
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c13
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)