Bug fix: Check for a valid effect before dereference
Reported on the dev list as... Crash with custom scenery
This commit is contained in:
parent
6d8e9e5bbc
commit
a3ffc77a9d
@ -287,12 +287,18 @@ public:
|
||||
} else {
|
||||
eg->setMaterial(NULL);
|
||||
}
|
||||
|
||||
// If effect requests normal generation, we do not include terragear
|
||||
// normals in the geometry
|
||||
bool include_normals = true;
|
||||
int n = eg->getEffect()->getGenerator(Effect::NORMAL);
|
||||
|
||||
auto eff = eg->getEffect();
|
||||
if (eff) {
|
||||
int n = eff->getGenerator(Effect::NORMAL);
|
||||
if (n != -1)
|
||||
include_normals = false;
|
||||
}
|
||||
|
||||
osg::Geometry* geometry = i->second.buildGeometry(useVBOs, include_normals);
|
||||
eg->runGenerators(geometry); // Generate extra data needed by effect
|
||||
eg->addDrawable(geometry);
|
||||
|
Loading…
Reference in New Issue
Block a user