From e8df7e8da5a075178224b130c0602b62c85508a9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 22 Aug 2012 21:40:20 +0200 Subject: Database*: fix nullptr dereference when no database is configured --- src/DatabaseQueue.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/DatabaseQueue.cxx') diff --git a/src/DatabaseQueue.cxx b/src/DatabaseQueue.cxx index 26ac2c6f..0e6e5784 100644 --- a/src/DatabaseQueue.cxx +++ b/src/DatabaseQueue.cxx @@ -49,11 +49,15 @@ bool findAddIn(struct player_control *pc, const char *uri, const struct locate_item_list *criteria, GError **error_r) { + const Database *db = GetDatabase(error_r); + if (db == nullptr) + return false; + const DatabaseSelection selection(uri, true, criteria); using namespace std::placeholders; const auto f = std::bind(AddToQueue, pc, _1, _2); - return GetDatabase()->Visit(selection, f, error_r); + return db->Visit(selection, f, error_r); } bool -- cgit v1.2.3