Don't crash on API errors while refreshing a channel

This commit is contained in:
Daniel Schulte 2020-12-04 09:01:15 +01:00
parent d1cdf1eee4
commit b272f64b2d
1 changed files with 1 additions and 1 deletions

2
yt.cpp
View File

@ -197,7 +197,7 @@ int Channel::fetch_new_videos(sqlite3 *db, progress_info *info, std::optional<st
while(true) {
const json response = api_request("https://content.googleapis.com/youtube/v3/playlistItems", params);
if(response.empty())
if(response.empty() || !response.count("pageInfo")) // TODO: Better API error detection/handling. For now just break if there is no pageInfo field.
break;
for(auto &item: response["items"]) {