avoid divide by zero when hubs not created before first websocket msg (#22315)

Этот коммит содержится в:
Doug Lauder
2023-02-13 08:48:42 -05:00
коммит произвёл GitHub
родитель 9f7e361621
Коммит 034cc6d0bd

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

@@ -121,6 +121,10 @@ func (ps *PlatformService) HubStop() {
// GetHubForUserId returns the hub for a given user id.
func (ps *PlatformService) GetHubForUserId(userID string) *Hub {
if len(ps.hubs) == 0 {
return nil
}
// TODO: check if caching the userID -> hub mapping
// is worth the memory tradeoff.
// https://mattermost.atlassian.net/browse/MM-26629.