Skip to content

Commit

Permalink
fixed issue with nil pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
FlameInTheDark committed Aug 27, 2020
1 parent 6ed0a96 commit 0b76e68
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions api/fun/images.go
Expand Up @@ -20,10 +20,12 @@ type ImageResponse struct {
func GetImageURL(category string) (string, error) {
resp, err := http.Get(fmt.Sprintf("https://botimages.realpha.ru/?category=%v", category))
if err != nil {
if resp.StatusCode == http.StatusOK {
fmt.Printf("Getting image url error: %v", err)
return "", errors.New("getting image url error")
}
return "", err
}

if resp.StatusCode == http.StatusOK {
fmt.Printf("Getting image url error: %v", err)
return "", errors.New("getting image url error")
}

var result ImageResponse
Expand Down

0 comments on commit 0b76e68

Please sign in to comment.