fix checking response when API returns an error

This commit is contained in:
rhysd 2017-12-29 18:14:43 +09:00
parent 11f67e340f
commit ed171e0fb6
1 changed files with 1 additions and 1 deletions

View File

@ -88,7 +88,7 @@ func (d *ReleaseDetector) DetectLatest(slug string) (release *Release, found boo
rels, res, err := d.api.Repositories.ListReleases(d.apiCtx, repo[0], repo[1], nil)
if err != nil {
log.Println("API returned an error response:", err)
if res.StatusCode == 404 {
if res != nil && res.StatusCode == 404 {
// 404 means repository not found or release not found. It's not an error here.
found = false
err = nil