Add missing null check to SGLight's dim-factor expression
This commit is contained in:
parent
a7a53921e4
commit
23a4fb1429
@ -123,12 +123,14 @@ SGLight::appendLight(const SGPropertyNode *configNode,
|
|||||||
if (dim_factor) {
|
if (dim_factor) {
|
||||||
const SGExpressiond *expression =
|
const SGExpressiond *expression =
|
||||||
read_value(dim_factor, modelRoot, "", 0, 1);
|
read_value(dim_factor, modelRoot, "", 0, 1);
|
||||||
|
if (expression) {
|
||||||
light->setUpdateCallback(
|
light->setUpdateCallback(
|
||||||
new SGLight::UpdateCallback(expression,
|
new SGLight::UpdateCallback(expression,
|
||||||
light->getAmbient(),
|
light->getAmbient(),
|
||||||
light->getDiffuse(),
|
light->getDiffuse(),
|
||||||
light->getSpecular()));
|
light->getSpecular()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
osg::Shape *debug_shape = nullptr;
|
osg::Shape *debug_shape = nullptr;
|
||||||
if (light->getType() == SGLight::Type::POINT) {
|
if (light->getType() == SGLight::Type::POINT) {
|
||||||
|
@ -56,12 +56,14 @@ SGLightAnimation::SGLightAnimation(simgear::SGTransientModelData &modelData) :
|
|||||||
if (dim_factor) {
|
if (dim_factor) {
|
||||||
const SGExpressiond *expression =
|
const SGExpressiond *expression =
|
||||||
read_value(dim_factor, modelData.getModelRoot(), "", 0, 1);
|
read_value(dim_factor, modelData.getModelRoot(), "", 0, 1);
|
||||||
|
if (expression) {
|
||||||
light->setUpdateCallback(
|
light->setUpdateCallback(
|
||||||
new SGLight::UpdateCallback(expression,
|
new SGLight::UpdateCallback(expression,
|
||||||
light->getAmbient(),
|
light->getAmbient(),
|
||||||
light->getDiffuse(),
|
light->getDiffuse(),
|
||||||
light->getSpecular()));
|
light->getSpecular()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
align->setName(getConfig()->getStringValue("name"));
|
align->setName(getConfig()->getStringValue("name"));
|
||||||
_light = align;
|
_light = align;
|
||||||
|
Loading…
Reference in New Issue
Block a user