Fix segfault when trying to load corrupt orthophoto

This commit is contained in:
Nathaniel Warner 2020-12-06 11:44:04 -08:00
parent 00ff35cdb7
commit f72ff7d2a2

View File

@ -219,6 +219,9 @@ namespace simgear {
path.concat(".png"); path.concat(".png");
if (path.exists()) { if (path.exists()) {
ImageRef image = osgDB::readRefImageFile(path.str()); ImageRef image = osgDB::readRefImageFile(path.str());
if (!image) {
return nullptr;
}
image->flipVertical(); image->flipVertical();
OrthophotoBounds bbox = OrthophotoBounds::fromBucket(bucket); OrthophotoBounds bbox = OrthophotoBounds::fromBucket(bucket);
return new Orthophoto(image, bbox); return new Orthophoto(image, bbox);