[banshee/1.5.1-fixes: 24/56] [StreamTagger] Ignore '\0' chars in strings returned by TagLib# (bgo#599806)



commit 00bda6450f98c279c7778891fc6c1d13cb7ccb76
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Fri Nov 6 20:31:56 2009 +1100

    [StreamTagger] Ignore '\0' chars in strings returned by TagLib# (bgo#599806)

 .../Banshee.Core/Banshee.Streaming/StreamTagger.cs |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs b/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
index 0b0d22e..17fd40d 100644
--- a/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
+++ b/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
@@ -67,8 +67,13 @@ namespace Banshee.Streaming
         private static string Choose (string priority, string fallback, bool flip)
         {
             return flip 
-                ? String.IsNullOrEmpty (fallback) ? priority : fallback
-                : String.IsNullOrEmpty (priority) ? fallback : priority;
+                ? IsNullOrEmpty (fallback) ? priority : fallback
+                : IsNullOrEmpty (priority) ? fallback : priority;
+        }
+
+        private static bool IsNullOrEmpty (string s)
+        {
+            return String.IsNullOrEmpty (s) || s.IndexOf ('\0') >= 0 && s.Trim ('\0').Length == 0;
         }
 
         #pragma warning disable 0169



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