Skip to content

Commit

Permalink
Fix crash on empty proxylist
Browse files Browse the repository at this point in the history
  • Loading branch information
arriven committed Mar 2, 2022
1 parent 5b845b2 commit 6406b10
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ func httpJob(ctx context.Context, l *logs.Logger, args JobArgs) error {
l.Debug("proxyURLs: %v", proxyURLs)
// Return random proxy from the list
proxy = func(r *http.Request) (*url.URL, error) {
if len(proxyURLs) == 0 {
return nil, fmt.Errorf("proxylist is empty")
}
proxyID := rand.Intn(len(proxyURLs))
proxyString := proxyURLs[proxyID]
u, err := url.Parse(proxyString)
Expand Down

0 comments on commit 6406b10

Please sign in to comment.