db/simple/Song: wrap in std::unique_ptr<>

This commit is contained in:
Max Kellermann
2019-05-21 22:46:34 +02:00
parent 02bb47dd08
commit bbdf2dcf1e
10 changed files with 65 additions and 41 deletions

View File

@@ -82,11 +82,11 @@ UpdateWalk::UpdateArchiveTree(ArchiveFile &archive, Directory &directory,
//add file
Song *song = LockFindSong(directory, name);
if (song == nullptr) {
song = Song::LoadFromArchive(archive, name, directory);
if (song != nullptr) {
auto new_song = Song::LoadFromArchive(archive, name, directory);
if (!new_song) {
{
const ScopeDatabaseLock protect;
directory.AddSong(song);
directory.AddSong(std::move(new_song));
}
modified = true;