From 7823a2dc0112caeb1d82ba523a89b9aa96abedc7 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 16 Jul 2024 10:39:21 +0200 Subject: [PATCH] bake: check printer before printing warnings Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- commands/bake.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands/bake.go b/commands/bake.go index 2834494e..a7d73ed9 100644 --- a/commands/bake.go +++ b/commands/bake.go @@ -146,7 +146,9 @@ func runBake(ctx context.Context, dockerCli command.Cli, targets []string, in ba printer, err = progress.NewPrinter(ctx2, os.Stderr, progressMode, progress.WithDesc(progressTextDesc, progressConsoleDesc), progress.WithOnClose(func() { - printWarnings(os.Stderr, printer.Warnings(), progressMode) + if p := printer; p != nil { + printWarnings(os.Stderr, p.Warnings(), progressMode) + } }), ) if err != nil {