diff --git a/app/backend/boxartmanager.cpp b/app/backend/boxartmanager.cpp index fb7c96b0..4f01d0bf 100644 --- a/app/backend/boxartmanager.cpp +++ b/app/backend/boxartmanager.cpp @@ -71,10 +71,10 @@ private: QUrl BoxArtManager::loadBoxArt(NvComputer* computer, NvApp& app) { - // Try to open the cached file - QString cacheFilePath = getFilePathForBoxArt(computer, app.id); - if (QFile::exists(cacheFilePath)) { - return QUrl::fromLocalFile(cacheFilePath); + // Try to open the cached file if it exists and contains data + QFile cacheFile(getFilePathForBoxArt(computer, app.id)); + if (cacheFile.exists() && cacheFile.size() > 0) { + return QUrl::fromLocalFile(cacheFile.fileName()); } // If we get here, we need to fetch asynchronously. @@ -109,6 +109,10 @@ QUrl BoxArtManager::loadBoxArtFromNetwork(NvComputer* computer, int appId) if (image.save(cachePath)) { return QUrl::fromLocalFile(cachePath); } + else { + // A failed save() may leave a zero byte file. Make sure that's removed. + QFile(cachePath).remove(); + } } return QUrl();