Database*: fix nullptr dereference when no database is configured

This commit is contained in:
Max Kellermann
2012-08-22 21:40:20 +02:00
parent af4252bc80
commit e8df7e8da5
5 changed files with 48 additions and 8 deletions

View File

@@ -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