check for nil cmd

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-09-14 12:58:51 +03:00
parent 2d1e6db9fd
commit d59db9df16

View File

@ -43,6 +43,7 @@ func (s *service) Init(opts ...Option) {
}
s.once.Do(func() {
if s.opts.Cmd != nil {
// set cmd name
if len(s.opts.Cmd.App().Name) == 0 {
s.opts.Cmd.App().Name = s.Server().Options().Name
@ -63,6 +64,7 @@ func (s *service) Init(opts ...Option) {
); err != nil {
logger.Fatalf("[cmd] init failed: %v", err)
}
}
})
if s.opts.Registry != nil {