]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Report error for invalid inner operand of unary expressions
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 27 Feb 2021 11:23:56 +0000 (12:23 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 27 Feb 2021 19:26:43 +0000 (20:26 +0100)
This fixes criticals like:

    vala_unary_expression_is_integer_type: assertion 'type != NULL' failed

vala/valaunaryexpression.vala

index a97c0b2046ee17e7c9e225272e98aa9bcd3da417..bf14f620704df0698470c60308a50e0d65634d30 100644 (file)
@@ -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) {