From ef4130e785b7803215287c38e57da1dec5d17592 Mon Sep 17 00:00:00 2001 From: Antonio Larrosa Date: Thu, 2 Aug 2018 11:59:16 +0200 Subject: [PATCH] Fix crash when the file doesn't belong to an album If the file doesn't belong to an album, we have to load a NAT and then move the file there. Also fix the call to self.tagger.move_file_to_nat which was missing a parameter (the file to move) --- picard/ui/searchdialog/track.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/picard/ui/searchdialog/track.py b/picard/ui/searchdialog/track.py index f10018797..0617e3761 100644 --- a/picard/ui/searchdialog/track.py +++ b/picard/ui/searchdialog/track.py @@ -197,10 +197,11 @@ class TrackSearchDialog(SearchDialog): # No files associated. Just a normal search. self.tagger.load_album(track["musicbrainz_albumid"]) else: - if self.file_: + if self.file_ and getattr(self.file_.parent, 'album', None): album = self.file_.parent.album - self.tagger.move_file_to_nat(track["musicbrainz_recordingid"]) + self.tagger.move_file_to_nat(self.file_, track["musicbrainz_recordingid"], node) if album._files == 0: self.tagger.remove_album(album) else: self.tagger.load_nat(track["musicbrainz_recordingid"], node) + self.tagger.move_file_to_nat(self.file_, track["musicbrainz_recordingid"], node)