Add nil check to setAuth()

This commit is contained in:
Elara 2022-12-10 12:42:27 -08:00
parent 1abba4eeea
commit f00bbaeb54
1 changed files with 4 additions and 0 deletions

View File

@ -150,6 +150,10 @@ func resError(res *http.Response, lr types.LemmyResponse) error {
}
func (c *Client) setAuth(data any) any {
if data == nil {
return data
}
val := reflect.New(reflect.TypeOf(data))
val.Elem().Set(reflect.ValueOf(data))