From f72ff7d2a27437137f83fe7deb02040e12e002a4 Mon Sep 17 00:00:00 2001 From: Nathaniel Warner Date: Sun, 6 Dec 2020 11:44:04 -0800 Subject: [PATCH] Fix segfault when trying to load corrupt orthophoto --- simgear/scene/util/OrthophotoManager.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/simgear/scene/util/OrthophotoManager.cxx b/simgear/scene/util/OrthophotoManager.cxx index 3a3ce9c8..73d15d31 100644 --- a/simgear/scene/util/OrthophotoManager.cxx +++ b/simgear/scene/util/OrthophotoManager.cxx @@ -219,6 +219,9 @@ namespace simgear { path.concat(".png"); if (path.exists()) { ImageRef image = osgDB::readRefImageFile(path.str()); + if (!image) { + return nullptr; + } image->flipVertical(); OrthophotoBounds bbox = OrthophotoBounds::fromBucket(bucket); return new Orthophoto(image, bbox);