[MM-18544] Initialise UserSearch struct before trying to decode JSON (#12198)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
4c4fbdc652
Коммит
85ce27fc93
@@ -33,14 +33,14 @@ func (u *UserSearch) ToJson() []byte {
|
|||||||
|
|
||||||
// UserSearchFromJson will decode the input and return a User
|
// UserSearchFromJson will decode the input and return a User
|
||||||
func UserSearchFromJson(data io.Reader) *UserSearch {
|
func UserSearchFromJson(data io.Reader) *UserSearch {
|
||||||
var us *UserSearch
|
us := UserSearch{}
|
||||||
json.NewDecoder(data).Decode(&us)
|
json.NewDecoder(data).Decode(&us)
|
||||||
|
|
||||||
if us.Limit == 0 {
|
if us.Limit == 0 {
|
||||||
us.Limit = USER_SEARCH_DEFAULT_LIMIT
|
us.Limit = USER_SEARCH_DEFAULT_LIMIT
|
||||||
}
|
}
|
||||||
|
|
||||||
return us
|
return &us
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserSearchOptions captures internal parameters derived from the user's permissions and a
|
// UserSearchOptions captures internal parameters derived from the user's permissions and a
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user