diff --git a/app/platform/web_hub.go b/app/platform/web_hub.go index 9e62da4264..8b54ce76c7 100644 --- a/app/platform/web_hub.go +++ b/app/platform/web_hub.go @@ -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.