Skip to content

Commit 278578d

Browse files
committed
BUG/MINOR: runtime: avoid any risk of nil pointer panic with runtime
client
1 parent 92098cd commit 278578d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

configure_data_plane.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -934,10 +934,10 @@ func configureRuntimeClient(ctx context.Context, confClient *configuration.Clien
934934
}
935935
}
936936
}
937-
// no process specific settings found, Issue a warning and return nil
937+
// no process specific settings found, Issue a warning and return empty runtime client
938938
if len(sockets) == 0 {
939939
log.Warning("Runtime API not configured, found multiple processes and no stats sockets bound to them.")
940-
return nil
940+
return runtimeClient
941941
// use only found process specific sockets issue a warning if not all processes have a socket configured
942942
}
943943
if len(sockets) < int(globalConf.Nbproc) {
@@ -954,10 +954,10 @@ func configureRuntimeClient(ctx context.Context, confClient *configuration.Clien
954954
} else {
955955
log.Warning("Runtime API not configured, not using it")
956956
}
957-
return nil
957+
return runtimeClient
958958
}
959959
log.Warning("Cannot read runtime API configuration, not using it")
960-
return nil
960+
return runtimeClient
961961
}
962962

963963
func handleSignals(ctx context.Context, cancel context.CancelFunc, sigs chan os.Signal, client *client_native.HAProxyClient, haproxyOptions dataplaneapi_config.HAProxyConfiguration, users *dataplaneapi_config.Users) {

0 commit comments

Comments
 (0)