]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Handle ArrayType in visit_delete_statement() as delete allows them
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 5 Mar 2019 20:16:15 +0000 (21:16 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 17 Mar 2019 18:40:19 +0000 (19:40 +0100)
codegen/valaccodebasemodule.vala

index cc3a03f7a3fdc889ca37e376e2a678fe0a3b6454..4156315e39192c45d2751e8ce243d6fc0ecb1621 100644 (file)
@@ -4043,9 +4043,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public override void visit_delete_statement (DeleteStatement stmt) {
-               var pointer_type = (PointerType) stmt.expression.value_type;
-               DataType type = pointer_type;
-               if (pointer_type.base_type.data_type != null && pointer_type.base_type.data_type.is_reference_type ()) {
+               unowned DataType type = stmt.expression.value_type;
+               unowned PointerType? pointer_type = type as PointerType;
+               if (pointer_type != null && pointer_type.base_type.data_type != null && pointer_type.base_type.data_type.is_reference_type ()) {
                        type = pointer_type.base_type;
                }