Add nil check to setAuth()
This commit is contained in:
parent
9beccacda1
commit
7c15588651
4
lemmy.go
4
lemmy.go
@ -150,6 +150,10 @@ func resError(res *http.Response, lr types.LemmyResponse) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) setAuth(data any) any {
|
func (c *Client) setAuth(data any) any {
|
||||||
|
if data == nil {
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
val := reflect.New(reflect.TypeOf(data))
|
val := reflect.New(reflect.TypeOf(data))
|
||||||
val.Elem().Set(reflect.ValueOf(data))
|
val.Elem().Set(reflect.ValueOf(data))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user