Add nil check to setAuth()

This commit is contained in:
Elara 2022-12-10 12:42:27 -08:00
parent 9beccacda1
commit 7c15588651

View File

@ -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))