From 89566233476b449772229856e0da0c74a01f88f2 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Thu, 15 Feb 2018 11:55:44 -0600 Subject: [PATCH] Add fix to top_videos for empty database --- src/invidious.cr | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 9b0bb7a7..1ca461c7 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -118,9 +118,13 @@ spawn do client = get_client(pool) args = [] of String - (1..top.size).each { |i| args << "($#{i})," } - args = args.join("") - args = args.chomp(",") + if top.size > 0 + (1..top.size).each { |i| args << "($#{i})," } + args = args.join("") + args = args.chomp(",") + else + next + end videos = [] of Video