[banshee] SaveTrackMetadataJob: check if PathPattern is null before renaming file



commit f43052cf76f2efdfc5aedc233b61d89aa30730c8
Author: Andres G. Aragoneses <knocte gmail com>
Date:   Sun Apr 7 22:02:06 2013 +0100

    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

 .../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 dfeb3a6..7f8d378 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]