mirror of https://github.com/procxx/kepka.git
Don't load bad image infinitely.
This commit is contained in:
parent
ead212f31b
commit
a10b91fe1a
|
@ -275,12 +275,16 @@ QImage RemoteSource::takeLoaded() {
|
||||||
return QImage();
|
return QImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto data = _loader->imageData(shrinkBox());
|
if (_loader->cancelled()) {
|
||||||
if (data.isNull()) {
|
|
||||||
_cancelled = true;
|
_cancelled = true;
|
||||||
destroyLoader();
|
destroyLoader();
|
||||||
return QImage();
|
return QImage();
|
||||||
}
|
}
|
||||||
|
auto data = _loader->imageData(shrinkBox());
|
||||||
|
if (data.isNull()) {
|
||||||
|
// Bad content in the image.
|
||||||
|
data = Image::Empty()->original();
|
||||||
|
}
|
||||||
|
|
||||||
setInformation(_loader->bytes().size(), data.width(), data.height());
|
setInformation(_loader->bytes().size(), data.width(), data.height());
|
||||||
|
|
||||||
|
@ -303,7 +307,7 @@ void RemoteSource::destroyLoader() {
|
||||||
|
|
||||||
void RemoteSource::loadLocal() {
|
void RemoteSource::loadLocal() {
|
||||||
if (_loader) {
|
if (_loader) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_loader = createLoader(Data::FileOrigin(), LoadFromLocalOnly, true);
|
_loader = createLoader(Data::FileOrigin(), LoadFromLocalOnly, true);
|
||||||
|
|
Loading…
Reference in New Issue