diff options
author | Max Kellermann <max@duempel.org> | 2012-08-22 21:40:20 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-08-22 21:40:20 +0200 |
commit | e8df7e8da5a075178224b130c0602b62c85508a9 (patch) | |
tree | 76d57e65c2094d98909ff2ada88abc717e5422f9 /src/DatabasePlaylist.cxx | |
parent | af4252bc8043487a47a42a07326caf44bc78714f (diff) | |
download | mpd-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/DatabasePlaylist.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/DatabasePlaylist.cxx b/src/DatabasePlaylist.cxx index c6ad9c543..69d87dfd7 100644 --- a/src/DatabasePlaylist.cxx +++ b/src/DatabasePlaylist.cxx @@ -43,11 +43,15 @@ search_add_to_playlist(const char *uri, const char *playlist_path_utf8, 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(AddSong, playlist_path_utf8, _1, _2); - return GetDatabase()->Visit(selection, f, error_r); + return db->Visit(selection, f, error_r); } bool |