Fix occur panic when invalid PublicKey parsing.

This commit is contained in:
Naoki Kosaka
2020-01-29 17:36:56 +09:00
parent 91e147ac0d
commit f90b6a85c0
3 changed files with 10 additions and 0 deletions

View File

@ -82,6 +82,10 @@ func (actor *Actor) RetrieveRemoteActor(url string, uaString string, cache *cach
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return errors.New(resp.Status)
}
data, _ := ioutil.ReadAll(resp.Body)
err = json.Unmarshal(data, &actor)
if err != nil {