From daa94de93ffc19e029d7050b52f205ab16e671a3 Mon Sep 17 00:00:00 2001 From: yuyi Date: Fri, 3 Jun 2022 22:41:30 +0800 Subject: [PATCH] cgen: fix autofree_variable() (fix #14576) (#14602) --- vlib/v/gen/c/cgen.v | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index a971ec20ac..f7a19c3391 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -2679,6 +2679,10 @@ fn (mut g Gen) autofree_scope_vars2(scope &ast.Scope, start_pos int, end_pos int } fn (mut g Gen) autofree_variable(v ast.Var) { + // filter out invalid variables + if v.typ == 0 { + return + } sym := g.table.sym(v.typ) // if v.name.contains('output2') { if g.is_autofree {