[vala] Fix crash on invalid cast expressions



commit adc026e82d5c0ecec19d40a665e8c29d3b6ae424
Author: Jürg Billeter <j bitron ch>
Date:   Sat Dec 19 15:30:17 2009 +0100

    Fix crash on invalid cast expressions
    
    Fixes bug 601614.

 vala/valacastexpression.vala |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala
index c0415b7..864c409 100644
--- a/vala/valacastexpression.vala
+++ b/vala/valacastexpression.vala
@@ -119,6 +119,12 @@ public class Vala.CastExpression : Expression {
 			return false;
 		}
 
+		if (inner.value_type == null) {
+			Report.error (source_reference, "Invalid cast expression");
+			error = true;
+			return false;
+		}
+
 		if (is_non_null_cast) {
 			// (!) non-null cast
 			value_type = inner.value_type.copy ();



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