aboutsummaryrefslogtreecommitdiffstats
path: root/src/database.c
diff options
context:
space:
mode:
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)