From 0aad9169e9d7ec5a1e7e82514b5f717b776fcd11 Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Thu, 6 Apr 2023 18:15:55 +0200 Subject: [PATCH] Fix nil pointer exception (#790) Nil pointer exception fix. The error handling was in wrong order. --- client/internal/connect.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/internal/connect.go b/client/internal/connect.go index 47c63e6d0..1d0585647 100644 --- a/client/internal/connect.go +++ b/client/internal/connect.go @@ -82,12 +82,12 @@ func RunClient(ctx context.Context, config *Config, statusRecorder *peer.Status, log.Debugf("conecting to the Management service %s", config.ManagementURL.Host) mgmClient, err := mgm.NewClient(engineCtx, config.ManagementURL.Host, myPrivateKey, mgmTlsEnabled) - mgmNotifier := statusRecorderToMgmConnStateNotifier(statusRecorder) - mgmClient.SetConnStateListener(mgmNotifier) - if err != nil { return wrapErr(gstatus.Errorf(codes.FailedPrecondition, "failed connecting to Management Service : %s", err)) } + mgmNotifier := statusRecorderToMgmConnStateNotifier(statusRecorder) + mgmClient.SetConnStateListener(mgmNotifier) + log.Debugf("connected to the Management service %s", config.ManagementURL.Host) defer func() { err = mgmClient.Close()