From: Carlo Teubner Date: Fri, 20 Aug 2010 07:52:25 +0000 (+0200) Subject: Fix crash on invalid switch expression X-Git-Tag: 0.9.8~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b85f9d387718f49fe255a216d1c8072f1059e9b1;p=thirdparty%2Fvala.git Fix crash on invalid switch expression Fixes bug 626397. --- diff --git a/vala/valaswitchstatement.vala b/vala/valaswitchstatement.vala index 1fbcb1649..c2066c51c 100644 --- a/vala/valaswitchstatement.vala +++ b/vala/valaswitchstatement.vala @@ -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;