db/DatabaseSong: make the Storage optional
Some database plugins don't use a Storage (e.g. UPnP), and with this plugin, DatabaseDetachSong() can crash.
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
#include <functional>
|
||||
|
||||
static void
|
||||
AddSong(const Storage &storage, const char *playlist_path_utf8,
|
||||
AddSong(const Storage *storage, const char *playlist_path_utf8,
|
||||
const LightSong &song)
|
||||
{
|
||||
spl_append_song(playlist_path_utf8,
|
||||
@@ -36,14 +36,14 @@ AddSong(const Storage &storage, const char *playlist_path_utf8,
|
||||
}
|
||||
|
||||
void
|
||||
search_add_to_playlist(const Database &db, const Storage &storage,
|
||||
search_add_to_playlist(const Database &db, const Storage *storage,
|
||||
const char *uri, const char *playlist_path_utf8,
|
||||
const SongFilter *filter)
|
||||
{
|
||||
const DatabaseSelection selection(uri, true, filter);
|
||||
|
||||
using namespace std::placeholders;
|
||||
const auto f = std::bind(AddSong, std::ref(storage),
|
||||
const auto f = std::bind(AddSong, storage,
|
||||
playlist_path_utf8, _1);
|
||||
db.Visit(selection, f);
|
||||
}
|
||||
|
Reference in New Issue
Block a user