]> 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 11:23:56 +0000 (12:23 +0100)
This fixes criticals like:

    vala_unary_expression_is_integer_type: assertion 'type != NULL' failed

vala/valaunaryexpression.vala

index 0d0dc4b2bc446dd52f996b6912bf7b47c24cc75d..80bee55403ef85b44bd4937cc8aba18341c108d8 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) {