Skip to content

Commit 4a12a41

Browse files
committed
images: work around Trakt only returning only null URLs
When no image is available Trakt sometimes returns the the image, but all the URL types are null. This happens for example for the poster of a shows season when no poster is available. This change checks if at least a single URL of, full, medium or thumb is set. And the image will then only be set when that's the case.
1 parent cb1cfab commit 4a12a41

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

traktimageset.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,13 @@ TraktImages *TraktImageSet::createImages(QVariant imageData)
133133
{
134134
if (!imageData.isValid()) {
135135
return 0;
136-
} else {
137-
return new TraktImages(imageData.toMap(), this);
136+
}
137+
138+
QVariantMap imageMap = imageData.toMap();
139+
if (!imageMap.value("full").isValid() && !imageMap.value("medium").isValid() && !imageMap.value("thumb").isValid()) {
140+
return 0;
141+
}
142+
else {
143+
return new TraktImages(imageMap, this);
138144
}
139145
}

0 commit comments

Comments
 (0)