[vala/staging] vala: Report error for invalid inner operand of unary expressions



commit ad9c0751574ec8f7c4fb55ba2f1fff383fc90d69
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Feb 27 12:23:56 2021 +0100

    vala: Report error for invalid inner operand of unary expressions
    
    This fixes criticals like:
    
        vala_unary_expression_is_integer_type: assertion 'type != NULL' failed

 vala/valaunaryexpression.vala | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/vala/valaunaryexpression.vala b/vala/valaunaryexpression.vala
index 0d0dc4b2b..80bee5540 100644
--- a/vala/valaunaryexpression.vala
+++ b/vala/valaunaryexpression.vala
@@ -158,6 +158,10 @@ public class Vala.UnaryExpression : Expression {
                        /* if there was an error in the inner expression, skip type check */
                        error = true;
                        return false;
+               } else if (inner.value_type == null) {
+                       error = true;
+                       Report.error (inner.source_reference, "Invalid inner operand");
+                       return false;
                }
 
                if (inner.value_type is FieldPrototype || inner.value_type is PropertyPrototype) {


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