Fix potential nil dereference error

Этот коммит содержится в:
Giorgi Bochorishvili
2023-01-23 16:33:45 +04:00
родитель 94e5e49753
Коммит 4bdc49d11d

Просмотреть файл

@@ -263,6 +263,13 @@ func NewServer(options ...Option) (*Server, error) {
return nil, errors.Wrap(err, "failed to initialize products")
}
// After channel is initialized set it to the App object
channelsWrapper, ok := serviceMap[product.ChannelKey].(*channelsWrapper)
if !ok {
return nil, errors.Wrap(err, "channels product is not initialized")
}
app.ch = channelsWrapper.app.ch
// It is important to initialize the hub only after the global logger is set
// to avoid race conditions while logging from inside the hub.
// Step 5: Start hub in platform which the hub depends on s.Channels() (step 4)