Fix panic when version check times out (#374)

This commit is contained in:
WithoutPants 2020-02-19 07:56:24 +11:00 committed by GitHub
parent 776727140f
commit bf49a23df8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -124,14 +124,14 @@ func GetLatestVersion(shortHash bool) (latestVersion string, latestRelease strin
release := githubReleasesResponse{} release := githubReleasesResponse{}
if response.StatusCode != http.StatusOK {
return "", "", fmt.Errorf("Github API request failed: %s", response.Status)
}
if err != nil { if err != nil {
return "", "", fmt.Errorf("Github API request failed: %s", err) return "", "", fmt.Errorf("Github API request failed: %s", err)
} }
if response.StatusCode != http.StatusOK {
return "", "", fmt.Errorf("Github API request failed: %s", response.Status)
}
defer response.Body.Close() defer response.Body.Close()
data, err := ioutil.ReadAll(response.Body) data, err := ioutil.ReadAll(response.Body)