store/channel_store_categories: fix index out of bounds error (#15423)

Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2020-09-15 15:25:12 +03:00
коммит произвёл GitHub
родитель 473e286feb
Коммит 9c2d2180e6

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

@@ -415,6 +415,9 @@ func (s SqlChannelStore) GetSidebarCategory(categoryId string) (*model.SidebarCa
if _, err := s.GetReplica().Select(&categories, sql, args...); err != nil {
return nil, model.NewAppError("SqlPostStore.GetSidebarCategory", "store.sql_channel.sidebar_categories.app_error", nil, err.Error(), http.StatusNotFound)
}
if len(categories) == 0 {
return nil, model.NewAppError("SqlPostStore.GetSidebarCategory", "store.sql_channel.sidebar_categories.app_error", nil, "", http.StatusNotFound)
}
result := &model.SidebarCategoryWithChannels{
SidebarCategory: categories[0].SidebarCategory,
Channels: make([]string, 0),