store/channel_store_categories: fix index out of bounds error (#15423)
Этот коммит содержится в:
коммит произвёл
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 {
|
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)
|
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{
|
result := &model.SidebarCategoryWithChannels{
|
||||||
SidebarCategory: categories[0].SidebarCategory,
|
SidebarCategory: categories[0].SidebarCategory,
|
||||||
Channels: make([]string, 0),
|
Channels: make([]string, 0),
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user