From 8c92e3d0c5e768afc9938bc661fbdd47b36b02f8 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 14 Mar 2025 07:01:55 +0200 Subject: [PATCH] v.markused: improve stability (avoid runtime crash) when processing generic functions (partial fix for #23927) --- vlib/v/markused/walker.v | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vlib/v/markused/walker.v b/vlib/v/markused/walker.v index 3cbe99bb55..b9d67c9e29 100644 --- a/vlib/v/markused/walker.v +++ b/vlib/v/markused/walker.v @@ -599,6 +599,9 @@ pub fn (mut w Walker) a_struct_info(sname string, info ast.Struct) { } pub fn (mut w Walker) fn_decl(mut node ast.FnDecl) { + if node == unsafe { nil } { + return + } if node.language == .c { w.mark_fn_as_used(node.fkey()) return @@ -616,6 +619,9 @@ pub fn (mut w Walker) fn_decl(mut node ast.FnDecl) { } pub fn (mut w Walker) call_expr(mut node ast.CallExpr) { + if node == unsafe { nil } { + return + } for arg in node.args { w.expr(arg.expr) }