From dde3189e66934abf63964e98105402a773026a62 Mon Sep 17 00:00:00 2001 From: Ned Palacios <7358345+nedpals@users.noreply.github.com> Date: Mon, 19 Apr 2021 19:58:30 +0800 Subject: [PATCH] checker: avoid get_type_symbol panic inside array_init (#9800) --- vlib/v/checker/checker.v | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 6f3da5837f..12156971b6 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -3298,12 +3298,16 @@ pub fn (mut c Checker) array_init(mut array_init ast.ArrayInit) ast.Type { if array_init.has_len { c.ensure_sumtype_array_has_default_value(array_init) } - c.ensure_type_exists(array_init.elem_type, array_init.elem_type_pos) or {} + if array_init.elem_type != 0 { + c.ensure_type_exists(array_init.elem_type, array_init.elem_type_pos) or {} + } return array_init.typ } if array_init.is_fixed { c.ensure_sumtype_array_has_default_value(array_init) - c.ensure_type_exists(array_init.elem_type, array_init.elem_type_pos) or {} + if array_init.elem_type != 0 { + c.ensure_type_exists(array_init.elem_type, array_init.elem_type_pos) or {} + } } // a = [] if array_init.exprs.len == 0 {