From 6e3297df4fd1247cc4523c1f172d81aeba8f508c Mon Sep 17 00:00:00 2001 From: Daniel Tam Date: Tue, 9 Jun 2020 14:41:49 -0500 Subject: [PATCH] fixed some base cases --- images.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/images.go b/images.go index 62e924d..a7f4082 100644 --- a/images.go +++ b/images.go @@ -115,6 +115,9 @@ func get_image(sub string) <-chan string { return } + // nothing found + ret <- "" + }() return ret @@ -260,7 +263,7 @@ func get_subreddit_image(sub string) <-chan string { if hint == "image" || hint == "link" || hint == "rich:video" { image, _ := jsonparser.GetString(out, "data", "children", "[" + strconv.Itoa(random_img) + "]", "data", "url") ret <- image - break + return } } }()