Add missing null check to SGLight's dim-factor expression
This commit is contained in:
parent
a7a53921e4
commit
23a4fb1429
@ -123,11 +123,13 @@ 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);
|
||||||
light->setUpdateCallback(
|
if (expression) {
|
||||||
new SGLight::UpdateCallback(expression,
|
light->setUpdateCallback(
|
||||||
light->getAmbient(),
|
new SGLight::UpdateCallback(expression,
|
||||||
light->getDiffuse(),
|
light->getAmbient(),
|
||||||
light->getSpecular()));
|
light->getDiffuse(),
|
||||||
|
light->getSpecular()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Shape *debug_shape = nullptr;
|
osg::Shape *debug_shape = nullptr;
|
||||||
|
@ -56,11 +56,13 @@ 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);
|
||||||
light->setUpdateCallback(
|
if (expression) {
|
||||||
new SGLight::UpdateCallback(expression,
|
light->setUpdateCallback(
|
||||||
light->getAmbient(),
|
new SGLight::UpdateCallback(expression,
|
||||||
light->getDiffuse(),
|
light->getAmbient(),
|
||||||
light->getSpecular()));
|
light->getDiffuse(),
|
||||||
|
light->getSpecular()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
align->setName(getConfig()->getStringValue("name"));
|
align->setName(getConfig()->getStringValue("name"));
|
||||||
|
Loading…
Reference in New Issue
Block a user