Merge pull request #52 from ajayyy/experimental

Prevented crash from thumbnail being missing
This commit is contained in:
Ajay Ramachandran 2019-12-28 23:30:45 -05:00 committed by GitHub
commit 306456c3c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -253,7 +253,7 @@ app.get('/api/postVideoSponsorTimes', async function (req, res) {
"name": userID "name": userID
}, },
"thumbnail": { "thumbnail": {
"url": data.items[0].snippet.thumbnails.maxres.url, "url": data.items[0].snippet.thumbnails.maxres ? data.items[0].snippet.thumbnails.maxres.url : "",
} }
}] }]
} }
@ -384,7 +384,7 @@ app.get('/api/voteOnSponsorTime', function (req, res) {
"name": userSubmissionCountResult.row.submissionCount === 0 ? "Report by New User" : (vipResult.row.userCount !== 0 ? "Report by VIP User" : "") "name": userSubmissionCountResult.row.submissionCount === 0 ? "Report by New User" : (vipResult.row.userCount !== 0 ? "Report by VIP User" : "")
}, },
"thumbnail": { "thumbnail": {
"url": data.items[0].snippet.thumbnails.maxres.url, "url": data.items[0].snippet.thumbnails.maxres ? data.items[0].snippet.thumbnails.maxres.url : "",
} }
}] }]
} }