fixed some base cases

This commit is contained in:
2020-06-09 14:41:49 -05:00
parent 968d670b29
commit 6e3297df4f

View File

@@ -115,6 +115,9 @@ func get_image(sub string) <-chan string {
return return
} }
// nothing found
ret <- ""
}() }()
return ret return ret
@@ -260,7 +263,7 @@ func get_subreddit_image(sub string) <-chan string {
if hint == "image" || hint == "link" || hint == "rich:video" { if hint == "image" || hint == "link" || hint == "rich:video" {
image, _ := jsonparser.GetString(out, "data", "children", "[" + strconv.Itoa(random_img) + "]", "data", "url") image, _ := jsonparser.GetString(out, "data", "children", "[" + strconv.Itoa(random_img) + "]", "data", "url")
ret <- image ret <- image
break return
} }
} }
}() }()