diff options
author | Andres G. Aragoneses <knocte@gmail.com> | 2013-04-07 22:02:06 +0100 |
---|---|---|
committer | Andres G. Aragoneses <knocte@gmail.com> | 2013-04-07 22:02:06 +0100 |
commit | f43052cf76f2efdfc5aedc233b61d89aa30730c8 (patch) | |
tree | ec830a1954bec5fe1d35032f24d01b6e15356f84 | |
parent | bc31ad620e9e15fe619314c979986742be7ee3a9 (diff) |
SaveTrackMetadataJob: check if PathPattern is null before renaming file
Since this change[1] in DatabaseTrackInfo, PathPattern property may return
null instead of a default PathPattern. Even though RenameFile () was
already checking if the track belonged to the MusicLibrarySource, this
check for null, to return early, is faster, and safer (because in the
future someone could implement RenameFile operation in non-Music sources
and could forget to do this null check).
[1] https://git.gnome.org/browse/banshee/commit/?id=2c82ffbeaf4f4ff9f996b4dfaf1bfc84064353f5
-rw-r--r-- | src/Core/Banshee.Services/Banshee.Metadata/SaveTrackMetadataJob.cs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Core/Banshee.Services/Banshee.Metadata/SaveTrackMetadataJob.cs b/src/Core/Banshee.Services/Banshee.Metadata/SaveTrackMetadataJob.cs index dfeb3a64b..7f8d378b8 100644 --- a/src/Core/Banshee.Services/Banshee.Metadata/SaveTrackMetadataJob.cs +++ b/src/Core/Banshee.Services/Banshee.Metadata/SaveTrackMetadataJob.cs @@ -125,6 +125,10 @@ namespace Banshee.Metadata private bool RenameFile (DatabaseTrackInfo track) { + if (track.PathPattern == null) { + return false; + } + SafeUri old_uri = track.Uri; bool in_library = old_uri.AbsolutePath.StartsWith (musicLibrarySource.BaseDirectoryWithSeparator); |