From 9d6caa1d5d2b49e3742fec43e5fde414a6100ed6 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Wed, 14 Apr 2021 22:49:25 -0700 Subject: [PATCH] checker: fix segfault in vls for struct field declarations, having custom initializers with fn calls (#9741) --- vlib/v/checker/checker.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 0968de04c9..bc36c89925 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -2062,7 +2062,7 @@ pub fn (mut c Checker) fn_call(mut call_expr ast.CallExpr) ast.Type { && func.mod != c.mod { c.error('function `$func.name` is private', call_expr.pos) } - if !c.cur_fn.is_deprecated && func.is_deprecated { + if c.cur_fn != 0 && !c.cur_fn.is_deprecated && func.is_deprecated { c.deprecate_fnmethod('function', func.name, func, call_expr) } if func.is_unsafe && !c.inside_unsafe