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,9 +242,11 @@ 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
tlscfg, err = make_server_tls_config(&cfg.TLS) if cfg != nil {
if err != nil { tlscfg, err = make_server_tls_config(&cfg.TLS)
return err if err != nil {
return err
}
} }
s, err = hodu.NewServer( 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 cc hodu.ClientConfig
var err error var err error
tlscfg, err = make_server_tls_config(&cfg.TLS) if cfg != nil {
if err != nil { tlscfg, err = make_server_tls_config(&cfg.TLS)
return err if err != nil {
return err
}
} }
c = hodu.NewClient( c = hodu.NewClient(