added nil checks before accessing the cfg pointer

This commit is contained in:
hyung-hwan 2024-12-07 01:49:11 +09:00
parent bc3bb06008
commit 634de1756a

View File

@ -242,10 +242,12 @@ func server_main(ctl_addrs []string, svcaddrs []string, cfg *ServerConfig) error
var tlscfg *tls.Config var tlscfg *tls.Config
var err error var err error
if cfg != nil {
tlscfg, err = make_server_tls_config(&cfg.TLS) tlscfg, err = make_server_tls_config(&cfg.TLS)
if err != nil { if err != nil {
return err return err
} }
}
s, err = hodu.NewServer( s, err = hodu.NewServer(
context.Background(), context.Background(),
@ -273,10 +275,12 @@ func client_main(ctl_addrs []string, server_addr string, peer_addrs []string, cf
var cc hodu.ClientConfig var cc hodu.ClientConfig
var err error var err error
if cfg != nil {
tlscfg, err = make_server_tls_config(&cfg.TLS) tlscfg, err = make_server_tls_config(&cfg.TLS)
if err != nil { if err != nil {
return err return err
} }
}
c = hodu.NewClient( c = hodu.NewClient(
context.Background(), context.Background(),