Fix nil pointers

This commit is contained in:
Wim 2016-08-14 23:04:28 +02:00
parent a997ae29ad
commit a1a11a88b3

View File

@ -255,7 +255,10 @@ func (m *MMClient) parseActionPost(rmsg *Message) {
} }
func (m *MMClient) UpdateUsers() error { func (m *MMClient) UpdateUsers() error {
mmusers, _ := m.Client.GetProfilesForDirectMessageList(m.Team.Id) mmusers, err := m.Client.GetProfilesForDirectMessageList(m.Team.Id)
if err != nil {
return errors.New(err.DetailedError)
}
m.Lock() m.Lock()
m.Users = mmusers.Data.(map[string]*model.User) m.Users = mmusers.Data.(map[string]*model.User)
m.Unlock() m.Unlock()
@ -263,8 +266,14 @@ func (m *MMClient) UpdateUsers() error {
} }
func (m *MMClient) UpdateChannels() error { func (m *MMClient) UpdateChannels() error {
mmchannels, _ := m.Client.GetChannels("") mmchannels, err := m.Client.GetChannels("")
mmchannels2, _ := m.Client.GetMoreChannels("") if err != nil {
return errors.New(err.DetailedError)
}
mmchannels2, err := m.Client.GetMoreChannels("")
if err != nil {
return errors.New(err.DetailedError)
}
m.Lock() m.Lock()
m.Team.Channels = mmchannels.Data.(*model.ChannelList) m.Team.Channels = mmchannels.Data.(*model.ChannelList)
m.Team.MoreChannels = mmchannels2.Data.(*model.ChannelList) m.Team.MoreChannels = mmchannels2.Data.(*model.ChannelList)