[rygel] core: Take care of null operands when printing expression



commit 24917dea4fedb3dd64c763208354adc8a4753729
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Nov 9 19:49:09 2009 +0200

    core: Take care of null operands when printing expression

 src/rygel/rygel-logical-expression.vala |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-logical-expression.vala b/src/rygel/rygel-logical-expression.vala
index d02b15b..dbf6492 100644
--- a/src/rygel/rygel-logical-expression.vala
+++ b/src/rygel/rygel-logical-expression.vala
@@ -45,8 +45,14 @@ public class Rygel.LogicalExpression :
     }
 
     public override string to_string () {
-        return "(%s %d %s)".printf (this.operand1.to_string (),
+        var operand1 = (this.operand1 != null)?
+                        this.operand1.to_string ():
+                        "none";
+        var operand2 = (this.operand2 != null)?
+                        this.operand2.to_string ():
+                        "none";
+        return "(%s %d %s)".printf (operand1,
                                     this.op,
-                                    this.operand2.to_string ());
+                                    operand2);
     }
 }



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