oob check
This commit is contained in:
parent
6c9e3f15ae
commit
29ff95e43e
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@ -47,6 +48,9 @@ func getNewestPost(subreddit string) (post, error) {
|
||||
if err != nil {
|
||||
return post{}, err
|
||||
}
|
||||
if len(resp.Data.Children) < 1 {
|
||||
return post{}, errors.New("bad data from reddit")
|
||||
}
|
||||
numS := re.FindStringSubmatch(resp.Data.Children[0].Data.Title)[0]
|
||||
num, err := strconv.Atoi(numS)
|
||||
if err != nil || numS == "" {
|
||||
|
Loading…
Reference in New Issue
Block a user