]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix crash on invalid switch expression
authorCarlo Teubner <carlo.teubner@gmail.com>
Fri, 20 Aug 2010 07:52:25 +0000 (09:52 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 20 Aug 2010 08:17:31 +0000 (10:17 +0200)
Fixes bug 626397.

vala/valaswitchstatement.vala

index 1fbcb164900b440538a90e6df569e8fdfcf0a4ff..c2066c51cedcf2234e06de5e079b4f6dc43f805f 100644 (file)
@@ -105,9 +105,10 @@ public class Vala.SwitchStatement : CodeNode, Statement {
                        return false;
                }
 
-               if (!(expression.value_type is IntegerType)
-                   && !(expression.value_type is EnumValueType)
-                   && !expression.value_type.compatible (analyzer.string_type)) {
+               if (expression.value_type == null ||
+                   (!(expression.value_type is IntegerType) &&
+                    !(expression.value_type is EnumValueType) &&
+                    !expression.value_type.compatible (analyzer.string_type))) {
                        Report.error (expression.source_reference, "Integer or string expression expected");
                        error = true;
                        return false;