From 2040a458b165e5bbbd3de9fd5d7d33ce119c779a Mon Sep 17 00:00:00 2001 From: Benjamin Blattberg Date: Fri, 8 Oct 2021 04:32:11 -0500 Subject: [PATCH] [FIX] Prevent segmentation fault with --no-lb and --verbose/trace (#775) --- pkg/client/ports.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/client/ports.go b/pkg/client/ports.go index c05a536f..79067d27 100644 --- a/pkg/client/ports.go +++ b/pkg/client/ports.go @@ -100,8 +100,9 @@ func TransformPorts(ctx context.Context, runtime runtimes.Runtime, cluster *k3d. } - // print generated loadbalancer config - if l.Log().GetLevel() >= logrus.DebugLevel { + // print generated loadbalancer config if exists + // (avoid segmentation fault if loadbalancer is disabled) + if l.Log().GetLevel() >= logrus.DebugLevel && cluster.ServerLoadBalancer != nil { yamlized, err := yaml.Marshal(cluster.ServerLoadBalancer.Config) if err != nil { l.Log().Errorf("error printing loadbalancer config: %v", err)