diff --git a/channels.go b/channels.go index 7439961..3792b99 100644 --- a/channels.go +++ b/channels.go @@ -2,6 +2,7 @@ package matterclient import ( "context" + "errors" "strings" "github.com/mattermost/mattermost/server/public/model" @@ -279,6 +280,11 @@ func (m *Client) UpdateChannelsTeam(teamID string) error { } func (m *Client) UpdateChannels() error { + if m.Team == nil { + m.logger.Errorf("cannot update channels: primary team is nil") + return errors.New("cannot update channels: primary team is nil") + } + if err := m.UpdateChannelsTeam(m.Team.ID); err != nil { return err }