From 634de1756a562937f939dec3aea6ffce8dcc8e9a Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sat, 7 Dec 2024 01:49:11 +0900 Subject: [PATCH] added nil checks before accessing the cfg pointer --- cmd/main.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index c467384..114a098 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -242,9 +242,11 @@ func server_main(ctl_addrs []string, svcaddrs []string, cfg *ServerConfig) error var tlscfg *tls.Config var err error - tlscfg, err = make_server_tls_config(&cfg.TLS) - if err != nil { - return err + if cfg != nil { + tlscfg, err = make_server_tls_config(&cfg.TLS) + if err != nil { + return err + } } s, err = hodu.NewServer( @@ -273,9 +275,11 @@ func client_main(ctl_addrs []string, server_addr string, peer_addrs []string, cf var cc hodu.ClientConfig var err error - tlscfg, err = make_server_tls_config(&cfg.TLS) - if err != nil { - return err + if cfg != nil { + tlscfg, err = make_server_tls_config(&cfg.TLS) + if err != nil { + return err + } } c = hodu.NewClient(