[banshee/1.5.1-fixes: 47/56] [StreamTagger] Trim '\0' chars returned by TagLib#



commit c5b13c649fda57577dd9529396c20377e1811d82
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Tue Dec 29 18:37:54 2009 +1100

    [StreamTagger] Trim '\0' chars returned by TagLib#
    
    Fixes bgo#605570

 .../Banshee.Core/Banshee.Streaming/StreamTagger.cs |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs b/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
index 17fd40d..b6071f9 100644
--- a/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
+++ b/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
@@ -66,14 +66,19 @@ namespace Banshee.Streaming
     
         private static string Choose (string priority, string fallback, bool flip)
         {
-            return flip 
+            return TrimZero (flip
                 ? IsNullOrEmpty (fallback) ? priority : fallback
-                : IsNullOrEmpty (priority) ? fallback : priority;
+                : IsNullOrEmpty (priority) ? fallback : priority);
         }
 
         private static bool IsNullOrEmpty (string s)
         {
-            return String.IsNullOrEmpty (s) || s.IndexOf ('\0') >= 0 && s.Trim ('\0').Length == 0;
+            return String.IsNullOrEmpty (s) || TrimZero (s).Length == 0;
+        }
+
+        private static string TrimZero (string s)
+        {
+            return s == null || s.IndexOf ('\0') == -1 ? s : s.Split ('\0')[0];
         }
 
         #pragma warning disable 0169



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