aboutsummaryrefslogtreecommitdiffstats
path: root/src/DatabaseQueue.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-22 21:40:20 +0200
committerMax Kellermann <max@duempel.org>2012-08-22 21:40:20 +0200
commite8df7e8da5a075178224b130c0602b62c85508a9 (patch)
tree76d57e65c2094d98909ff2ada88abc717e5422f9 /src/DatabaseQueue.cxx
parentaf4252bc8043487a47a42a07326caf44bc78714f (diff)
downloadmpd-e8df7e8da5a075178224b130c0602b62c85508a9.tar.gz
mpd-e8df7e8da5a075178224b130c0602b62c85508a9.tar.xz
mpd-e8df7e8da5a075178224b130c0602b62c85508a9.zip
Database*: fix nullptr dereference when no database is configured
Diffstat (limited to '')
-rw-r--r--src/DatabaseQueue.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/DatabaseQueue.cxx b/src/DatabaseQueue.cxx
index 26ac2c6fd..0e6e57848 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