[hyena] Fix QueryField.ToTermString with null value (bgo#628087)



commit 23f206a1d9b3ba344f0b8efcc05e28e58456e80f
Author: Zhou Ting <ting z zhou intel com>
Date:   Tue Mar 22 10:09:09 2011 -0500

    Fix QueryField.ToTermString with null value (bgo#628087)
    
    Signed-off-by: Gabriel Burt <gabriel burt gmail com>

 Hyena/Hyena.Query/QueryField.cs |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/Hyena/Hyena.Query/QueryField.cs b/Hyena/Hyena.Query/QueryField.cs
index 75288d2..e6021c4 100644
--- a/Hyena/Hyena.Query/QueryField.cs
+++ b/Hyena/Hyena.Query/QueryField.cs
@@ -173,11 +173,14 @@ namespace Hyena.Query
 
         public static string ToTermString (string alias, string op, string value)
         {
-            value = String.Format (
-                "{1}{0}{1}",
-                value, value.IndexOf (" ") == -1 ? String.Empty : "\""
-            );
-
+            if (!String.IsNullOrEmpty (value)) {
+                value = String.Format (
+                    "{1}{0}{1}",
+                    value, value.IndexOf (" ") == -1 ? String.Empty : "\""
+                );
+            } else {
+                value = String.Empty;
+            }
             return String.IsNullOrEmpty (alias)
                 ? value
                 : String.Format ("{0}{1}{2}", alias, op, value);



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