[vala/0.10: 9/38] Fix crash on invalid switch expression



commit b85f9d387718f49fe255a216d1c8072f1059e9b1
Author: Carlo Teubner <carlo teubner gmail com>
Date:   Fri Aug 20 09:52:25 2010 +0200

    Fix crash on invalid switch expression
    
    Fixes bug 626397.

 vala/valaswitchstatement.vala |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/vala/valaswitchstatement.vala b/vala/valaswitchstatement.vala
index 1fbcb16..c2066c5 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;



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