Added some error checking when downloading thumbnails in the scraper GUI.

This commit is contained in:
Leon Styhre 2022-10-25 00:19:02 +02:00
parent cbb62775ac
commit c5098a62d5
2 changed files with 3 additions and 3 deletions

View file

@ -554,7 +554,7 @@ void GuiScraperSearch::updateInfoPane()
// Cache the thumbnail image in mScraperResults so that we don't need to download
// it every time the list is scrolled back and forth.
if (mScraperResults[i].thumbnailImageData.size() > 0) {
if (mScraperResults[i].thumbnailImageData.size() > 350) {
std::string content {mScraperResults[i].thumbnailImageData};
mResultThumbnail->setImage(content.data(), content.length());
mGrid.onSizeChanged(); // A hack to fix the thumbnail position since its size changed.
@ -837,7 +837,7 @@ void GuiScraperSearch::updateThumbnail()
}
// Activate the thumbnail in the GUI.
std::string content {mScraperResults[mResultList->getCursorId()].thumbnailImageData};
if (content.size() > 0) {
if (content.size() > 350) {
mResultThumbnail->setImage(content.data(), content.length());
mGrid.onSizeChanged(); // A hack to fix the thumbnail position since its size changed.
}

View file

@ -150,7 +150,7 @@ void GuiScraperSingle::onSizeChanged()
mGrid.setColWidthPerc(1, 0.04f);
mGrid.setSize(glm::round(mSize));
mBackground.fitTo(mSize, glm::vec3 {}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize, glm::vec3 {0.0f, 0.0f, 0.0f}, glm::vec2 {-32.0f, -32.0f});
// Add some extra margins to the game name.
const float newSizeX {mSize.x * 0.96f};