Launcher: reduce warnings loading thumbnail data
This commit is contained in:
parent
b6cd4c8726
commit
e4343f4f46
1 changed files with 12 additions and 8 deletions
|
@ -37,8 +37,10 @@ public:
|
||||||
|
|
||||||
QImage img = QImage::fromData(QByteArray::fromRawData(reinterpret_cast<const char*>(bytes), length));
|
QImage img = QImage::fromData(QByteArray::fromRawData(reinterpret_cast<const char*>(bytes), length));
|
||||||
if (img.isNull()) {
|
if (img.isNull()) {
|
||||||
qWarning() << "failed to load image data for URL:" <<
|
if (length > 0) {
|
||||||
QString::fromStdString(aThumbnailUrl);
|
// warn if we had valid bytes but couldn't load it, i.e corrupted data or similar
|
||||||
|
qWarning() << "failed to load image data for URL:" << QString::fromStdString(aThumbnailUrl);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,13 +132,15 @@ void ThumbnailImageItem::setAircraftUri(QString uri)
|
||||||
const QString thumbnailPath = aircraftSetPath.dir().filePath("thumbnail.jpg");
|
const QString thumbnailPath = aircraftSetPath.dir().filePath("thumbnail.jpg");
|
||||||
m_imageUrl = QUrl::fromLocalFile(thumbnailPath);
|
m_imageUrl = QUrl::fromLocalFile(thumbnailPath);
|
||||||
|
|
||||||
QImage img;
|
if (QFileInfo(thumbnailPath).exists()) {
|
||||||
if (img.load(thumbnailPath)) {
|
QImage img;
|
||||||
setImage(img);
|
if (img.load(thumbnailPath)) {
|
||||||
} else {
|
setImage(img);
|
||||||
qWarning() << Q_FUNC_INFO << "failed to load thumbnail from:" << thumbnailPath;
|
} else {
|
||||||
|
qWarning() << Q_FUNC_INFO << "failed to load thumbnail from:" << thumbnailPath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} // of local aircraft case
|
||||||
|
|
||||||
emit aircraftUriChanged();
|
emit aircraftUriChanged();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue