From 2a6d160e07672878ddd03bdbc8abc8440730a4a8 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 24 Jul 2024 16:09:29 +0200 Subject: pkg/runtest: fix nil deref on test failures --- pkg/runtest/run.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go index 110ec15d4..501f92dd3 100644 --- a/pkg/runtest/run.go +++ b/pkg/runtest/run.go @@ -537,8 +537,12 @@ func checkResult(req *runRequest) error { return err } if req.repeat != len(infos) { + infoCalls := -1 + if req.result.Info != nil { + infoCalls = len(req.result.Info.Calls) + } return fmt.Errorf("should repeat %v times, but repeated %v, prog calls %v, info calls %v\n%s", - req.repeat, len(infos), req.Prog.Calls, len(req.result.Info.Calls), req.result.Output) + req.repeat, len(infos), req.Prog.Calls, infoCalls, req.result.Output) } } calls := make(map[string]bool) -- cgit mrf-deployment