fix crash on invalid operand, fixes bug 511546
authorJuerg Billeter <j@bitron.ch>
Wed, 23 Jan 2008 16:05:43 +0000 (16:05 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Wed, 23 Jan 2008 16:05:43 +0000 (16:05 +0000)
2008-01-23  Juerg Billeter  <j@bitron.ch>

* vala/valasemanticanalyzer.vala: fix crash on invalid operand,
  fixes bug 511546

svn path=/trunk/; revision=895

ChangeLog
vala/valasemanticanalyzer.vala

index 9e625d9..bcc7144 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-01-23  Jürg Billeter  <j@bitron.ch>
 
+       * vala/valasemanticanalyzer.vala: fix crash on invalid operand,
+         fixes bug 511546
+
+2008-01-23  Jürg Billeter  <j@bitron.ch>
+
        * vala/Makefile.am, vala/valabasicblock.vala, vala/valacfgbuilder.vala,
          vala/valadostatement.vala, vala/valaforstatement.vala,
          vala/valaifstatement.vala, vala/valamemorymanager.vala,
index b4b1525..d83e5c1 100644 (file)
@@ -2363,9 +2363,15 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        return;
                }
 
+               if (expr.left.static_type == null) {
+                       Report.error (expr.source_reference, "invalid operand");
+                       expr.error = true;
+                       return;
+               }
+
                if (expr.left.static_type.data_type == string_type.data_type
                    && expr.operator == BinaryOperator.PLUS) {
-                       if (expr.right.static_type.data_type != string_type.data_type) {
+                       if (expr.right.static_type == null || expr.right.static_type.data_type != string_type.data_type) {
                                expr.error = true;
                                Report.error (expr.source_reference, "Operands must be strings");
                                return;