Allow for playlists to be created through ISimpleDataProvider with an

empty tracklist.
This commit is contained in:
casey langen 2017-09-30 23:57:21 -07:00
parent 0fcd05dc2c
commit acd5a94c10
2 changed files with 7 additions and 2 deletions

View File

@ -65,7 +65,9 @@ TrackList::TrackList(TrackList* other)
TrackList::TrackList(ILibraryPtr library, int64_t trackIds[], size_t trackIdCount)
: library(library) {
this->ids.insert(this->ids.end(), &trackIds[0], &trackIds[trackIdCount]);
if (trackIdCount > 0) {
this->ids.insert(this->ids.end(), &trackIds[0], &trackIds[trackIdCount]);
}
}
TrackList::~TrackList() {

View File

@ -792,7 +792,10 @@ void WebSocketServer::RespondWithSavePlaylist(connection_hdl connection, json& r
size_t count = ids.size();
int64_t* idArray = new int64_t[count];
std::copy(ids.begin(), ids.end(), idArray);
if (count > 0) {
std::copy(ids.begin(), ids.end(), idArray);
}
uint64_t newPlaylistId = this->context.dataProvider
->SavePlaylist(idArray, count, name.c_str(), id);