Commit 3b68bb5b authored by Carlo Teubner's avatar Carlo Teubner Committed by Jürg Billeter

Fix crash on invalid switch expression

Fixes bug 626397.
parent aa23c4e1
......@@ -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;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment